<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name=Generator content="Microsoft Word 14 (filtered)">

<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Helvetica;
	panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
	{font-family:Courier;
	panose-1:2 7 4 9 2 2 5 2 4 4;}
@font-face
	{font-family:"Tms Rmn";
	panose-1:2 2 6 3 4 5 5 2 3 4;}
@font-face
	{font-family:Helv;
	panose-1:2 11 6 4 2 2 2 3 2 4;}
@font-face
	{font-family:"New York";
	panose-1:2 4 5 3 6 5 6 2 3 4;}
@font-face
	{font-family:System;
	panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:"MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
	{font-family:Batang;
	panose-1:2 3 6 0 0 1 1 1 1 1;}
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:PMingLiU;
	panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
	{font-family:"MS Gothic";
	panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
	{font-family:Dotum;
	panose-1:2 11 6 0 0 1 1 1 1 1;}
@font-face
	{font-family:黑体;
	panose-1:2 1 6 9 6 1 1 1 1 1;}
@font-face
	{font-family:MingLiU;
	panose-1:2 2 5 9 0 0 0 0 0 0;}
@font-face
	{font-family:Mincho;
	panose-1:2 2 6 9 4 3 5 8 3 5;}
@font-face
	{font-family:Gulim;
	panose-1:2 11 6 0 0 1 1 1 1 1;}
@font-face
	{font-family:Century;
	panose-1:2 4 6 4 5 5 5 2 3 4;}
@font-face
	{font-family:"Angsana New";
	panose-1:2 2 6 3 5 4 5 2 3 4;}
@font-face
	{font-family:"Cordia New";
	panose-1:2 11 3 4 2 2 2 2 2 4;}
@font-face
	{font-family:Mangal;
	panose-1:2 4 5 3 5 2 3 3 2 2;}
@font-face
	{font-family:Latha;
	panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
	{font-family:Sylfaen;
	panose-1:1 10 5 2 5 3 6 3 3 3;}
@font-face
	{font-family:Vrinda;
	panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
	{font-family:Raavi;
	panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
	{font-family:Shruti;
	panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
	{font-family:Sendnya;
	panose-1:0 0 4 0 0 0 0 0 0 0;}
@font-face
	{font-family:Gautami;
	panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
	{font-family:Tunga;
	panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
	{font-family:"Estrangelo Edessa";
	panose-1:3 8 6 0 0 0 0 0 0 0;}
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:"Arial Unicode MS";
	panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
	{font-family:Cambria;
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:方正小标宋简体;}
@font-face
	{font-family:"\@黑体";
	panose-1:2 1 6 9 6 1 1 1 1 1;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:"\@方正小标宋简体";}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
h1
	{mso-style-link:"标题 1 Char";
	margin-top:17.0pt;
	margin-right:0cm;
	margin-bottom:16.5pt;
	margin-left:7.2pt;
	text-align:center;
	text-indent:-7.2pt;
	page-break-after:avoid;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
h2
	{mso-style-link:"标题 2 Char";
	margin-top:13.0pt;
	margin-right:0cm;
	margin-bottom:13.0pt;
	margin-left:0cm;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:0cm;
	page-break-after:avoid;
	font-size:16.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
h3
	{mso-style-link:"标题 3 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:0cm;
	page-break-after:avoid;
	font-size:14.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
h4
	{mso-style-link:"标题 4 Char";
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:28.8pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-28.8pt;
	page-break-after:avoid;
	font-size:12.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
h5
	{mso-style-link:"标题 5 Char";
	margin-top:14.0pt;
	margin-right:0cm;
	margin-bottom:14.5pt;
	margin-left:36.0pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-36.0pt;
	line-height:156%;
	page-break-after:avoid;
	font-size:14.0pt;
	font-family:宋体;
	font-weight:bold;}
h6
	{mso-style-link:"标题 6 Char";
	margin-top:12.0pt;
	margin-right:0cm;
	margin-bottom:3.2pt;
	margin-left:43.2pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-43.2pt;
	line-height:133%;
	page-break-after:avoid;
	font-size:12.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
p.MsoHeading7, li.MsoHeading7, div.MsoHeading7
	{mso-style-link:"标题 7 Char";
	margin-top:12.0pt;
	margin-right:0cm;
	margin-bottom:3.2pt;
	margin-left:50.4pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-50.4pt;
	line-height:133%;
	page-break-after:avoid;
	font-size:12.0pt;
	font-family:宋体;
	font-weight:bold;}
p.MsoHeading8, li.MsoHeading8, div.MsoHeading8
	{mso-style-link:"标题 8 Char";
	margin-top:12.0pt;
	margin-right:0cm;
	margin-bottom:3.2pt;
	margin-left:57.6pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-72.0pt;
	line-height:133%;
	page-break-after:avoid;
	font-size:12.0pt;
	font-family:"Arial","sans-serif";}
p.MsoHeading9, li.MsoHeading9, div.MsoHeading9
	{mso-style-link:"标题 9 Char";
	margin-top:12.0pt;
	margin-right:0cm;
	margin-bottom:3.2pt;
	margin-left:64.8pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-79.2pt;
	line-height:133%;
	page-break-after:avoid;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.MsoIndex1, li.MsoIndex1, div.MsoIndex1
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:10.5pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-10.5pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoIndex2, li.MsoIndex2, div.MsoIndex2
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-10.5pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoIndex3, li.MsoIndex3, div.MsoIndex3
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:31.5pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-10.5pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoIndex4, li.MsoIndex4, div.MsoIndex4
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:42.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-10.5pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoIndex5, li.MsoIndex5, div.MsoIndex5
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:52.5pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-10.5pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoIndex6, li.MsoIndex6, div.MsoIndex6
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:63.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-10.5pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoIndex7, li.MsoIndex7, div.MsoIndex7
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:73.5pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-10.5pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoIndex8, li.MsoIndex8, div.MsoIndex8
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:84.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-10.5pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoIndex9, li.MsoIndex9, div.MsoIndex9
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:94.5pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-10.5pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;
	font-weight:bold;}
p.MsoToc2, li.MsoToc2, div.MsoToc2
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoToc3, li.MsoToc3, div.MsoToc3
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:42.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoToc4, li.MsoToc4, div.MsoToc4
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:31.5pt;
	margin-bottom:.0001pt;
	font-size:9.0pt;
	font-family:宋体;}
p.MsoToc5, li.MsoToc5, div.MsoToc5
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:42.0pt;
	margin-bottom:.0001pt;
	font-size:9.0pt;
	font-family:宋体;}
p.MsoToc6, li.MsoToc6, div.MsoToc6
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:52.5pt;
	margin-bottom:.0001pt;
	font-size:9.0pt;
	font-family:宋体;}
p.MsoToc7, li.MsoToc7, div.MsoToc7
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:63.0pt;
	margin-bottom:.0001pt;
	font-size:9.0pt;
	font-family:宋体;}
p.MsoToc8, li.MsoToc8, div.MsoToc8
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:73.5pt;
	margin-bottom:.0001pt;
	font-size:9.0pt;
	font-family:宋体;}
p.MsoToc9, li.MsoToc9, div.MsoToc9
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:84.0pt;
	margin-bottom:.0001pt;
	font-size:9.0pt;
	font-family:宋体;}
p.MsoFootnoteText, li.MsoFootnoteText, div.MsoFootnoteText
	{mso-style-link:"脚注文本 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	layout-grid-mode:char;
	font-size:9.0pt;
	font-family:宋体;}
p.MsoCommentText, li.MsoCommentText, div.MsoCommentText
	{mso-style-link:"批注文字 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoHeader, li.MsoHeader, div.MsoHeader
	{mso-style-link:"页眉 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	layout-grid-mode:char;
	border:none;
	padding:0cm;
	font-size:9.0pt;
	font-family:宋体;}
p.MsoFooter, li.MsoFooter, div.MsoFooter
	{mso-style-link:"页脚 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	layout-grid-mode:char;
	font-size:9.0pt;
	font-family:宋体;}
p.MsoIndexHeading, li.MsoIndexHeading, div.MsoIndexHeading
	{mso-style-name:"索引标题\,索引类目\,索引类目1\,索引类目2";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoCaption, li.MsoCaption, div.MsoCaption
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.MsoTof, li.MsoTof, div.MsoTof
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:42.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-21.0pt;
	font-size:10.5pt;
	font-family:宋体;}
span.MsoFootnoteReference
	{vertical-align:super;}
p.MsoList, li.MsoList, div.MsoList
	{margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.0pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoList2, li.MsoList2, div.MsoList2
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoList4, li.MsoList4, div.MsoList4
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.MsoDate, li.MsoDate, div.MsoDate
	{mso-style-link:"日期 Char";
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:5.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
a:link, span.MsoHyperlink
	{mso-style-name:"超链接\,超级链接";
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
p
	{mso-style-name:"普通\(网站\)\,普通 \(Web\)\,普通 \(Web\)1\,普通 \(Web\)2\,普通 \(Web\)3";
	margin-right:0cm;
	margin-left:0cm;
	font-size:12.0pt;
	font-family:宋体;}
pre
	{mso-style-name:"HTML 预设格式\,HTML 预先格式化\,HTML 预先格式化1\,HTML 预先格式化2\,HTML 预先格式化3";
	mso-style-link:"HTML 预设格式 Char\,HTML 预先格式化 Char\,HTML 预先格式化1 Char\,HTML 预先格式化2 Char\,HTML 预先格式化3 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:宋体;}
tt
	{font-family:黑体;}
p.MsoCommentSubject, li.MsoCommentSubject, div.MsoCommentSubject
	{mso-style-link:"批注主题 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.5pt;
	font-family:宋体;
	font-weight:bold;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-link:"批注框文本 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:9.0pt;
	font-family:宋体;}
p.1, li.1, div.1
	{mso-style-name:样式1;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.0pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.a, li.a, div.a
	{mso-style-name:代码程序;
	mso-style-link:"代码程序 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:宋体;}
span.Char
	{mso-style-name:"代码程序 Char";
	mso-style-link:代码程序;
	font-family:宋体;}
p.a0, li.a0, div.a0
	{mso-style-name:图说明;
	mso-style-link:"图说明 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
span.Char0
	{mso-style-name:"图说明 Char";
	mso-style-link:图说明;
	font-family:宋体;}
p.0, li.0, div.0
	{mso-style-name:封面0;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:36.0pt;
	font-family:宋体;
	font-weight:bold;}
p.10, li.10, div.10
	{mso-style-name:封面1;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:18.0pt;
	font-family:宋体;
	font-weight:bold;}
p.11, li.11, div.11
	{mso-style-name:非标题1;
	margin-top:7.8pt;
	margin-right:0cm;
	margin-bottom:7.8pt;
	margin-left:0cm;
	text-align:center;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.a1, li.a1, div.a1
	{mso-style-name:文本居中;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.3CharChar, li.3CharChar, div.3CharChar
	{mso-style-name:"图中文字3 Char Char";
	mso-style-link:"图中文字3 Char Char Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	line-height:9.0pt;
	font-size:8.0pt;
	font-family:宋体;}
span.3CharCharChar
	{mso-style-name:"图中文字3 Char Char Char";
	mso-style-link:"图中文字3 Char Char";
	font-family:宋体;}
p.post, li.post, div.post
	{mso-style-name:邮件post;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:right;
	line-height:11.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.3, li.3, div.3
	{mso-style-name:图中字体3;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.3CharChar1CharCharChar
	{mso-style-name:"图中文字3 Char Char1 Char Char Char";
	font-family:宋体;}
span.3CharChar1CharChar
	{mso-style-name:"图中文字3 Char Char1 Char Char";
	font-family:宋体;}
p.5Char, li.5Char, div.5Char
	{mso-style-name:"图中文字5号 Char";
	mso-style-link:"图中文字5号 Char Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
span.5CharChar
	{mso-style-name:"图中文字5号 Char Char";
	mso-style-link:"图中文字5号 Char";
	font-family:宋体;}
p.5CharChar0, li.5CharChar0, div.5CharChar0
	{mso-style-name:"图中文字小5号 Char Char";
	mso-style-link:"图中文字小5号 Char Char Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
span.5CharCharChar
	{mso-style-name:"图中文字小5号 Char Char Char";
	mso-style-link:"图中文字小5号 Char Char";
	font-family:宋体;}
p.5Char0, li.5Char0, div.5Char0
	{mso-style-name:"图中文字小5号 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
p.5, li.5, div.5
	{mso-style-name:图中文字小5号;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	layout-grid-mode:char;
	font-size:9.0pt;
	font-family:宋体;}
p.2, li.2, div.2
	{mso-style-name:代码程序2;
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:宋体;}
p.20, li.20, div.20
	{mso-style-name:图说明2;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.21, li.21, div.21
	{mso-style-name:文本居中2;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.3CharCharCharCharChar, li.3CharCharCharCharChar, div.3CharCharCharCharChar
	{mso-style-name:"图中文字3 Char Char Char Char Char";
	mso-style-link:"图中文字3 Char Char Char Char Char Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	line-height:9.0pt;
	font-size:8.0pt;
	font-family:宋体;}
span.3CharCharCharCharCharChar
	{mso-style-name:"图中文字3 Char Char Char Char Char Char";
	mso-style-link:"图中文字3 Char Char Char Char Char";
	font-family:宋体;}
p.a2, li.a2, div.a2
	{mso-style-name:图居中;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.110, li.110, div.110
	{mso-style-name:"样式 标题 1 + 居中1";
	margin-right:0cm;
	margin-left:0cm;
	text-align:center;
	page-break-after:avoid;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
span.1Char
	{mso-style-name:"标题 1 Char";
	mso-style-link:"标题 1";
	font-weight:bold;}
p.22, li.22, div.22
	{mso-style-name:"样式 列表 2 + 居中";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.23, li.23, div.23
	{mso-style-name:列表2;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.50, li.50, div.50
	{mso-style-name:图中文字5号;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.111, li.111, div.111
	{mso-style-name:样式11;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.0pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.12, li.12, div.12
	{mso-style-name:代码程序1;
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:宋体;}
p.13, li.13, div.13
	{mso-style-name:图说明1;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.01, li.01, div.01
	{mso-style-name:封面01;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:36.0pt;
	font-family:宋体;
	font-weight:bold;}
p.112, li.112, div.112
	{mso-style-name:封面11;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:18.0pt;
	font-family:宋体;
	font-weight:bold;}
p.113, li.113, div.113
	{mso-style-name:非标题11;
	margin-top:7.8pt;
	margin-right:0cm;
	margin-bottom:7.8pt;
	margin-left:0cm;
	text-align:center;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.14, li.14, div.14
	{mso-style-name:文本居中1;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.3Char1, li.3Char1, div.3Char1
	{mso-style-name:"图中文字3 Char1";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	line-height:9.0pt;
	font-size:8.0pt;
	font-family:宋体;}
p.post1, li.post1, div.post1
	{mso-style-name:邮件post1;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:right;
	line-height:11.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.31, li.31, div.31
	{mso-style-name:图中字体31;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.5Char1, li.5Char1, div.5Char1
	{mso-style-name:"图中文字5号 Char1";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.5CharChar1, li.5CharChar1, div.5CharChar1
	{mso-style-name:"图中文字小5号 Char Char1";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
p.5Char10, li.5Char10, div.5Char10
	{mso-style-name:"图中文字小5号 Char1";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
p.51, li.51, div.51
	{mso-style-name:图中文字小5号1;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
p.120, li.120, div.120
	{mso-style-name:样式12;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.0pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.02, li.02, div.02
	{mso-style-name:封面02;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:36.0pt;
	font-family:宋体;
	font-weight:bold;}
p.121, li.121, div.121
	{mso-style-name:封面12;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:18.0pt;
	font-family:宋体;
	font-weight:bold;}
p.122, li.122, div.122
	{mso-style-name:非标题12;
	margin-top:7.8pt;
	margin-right:0cm;
	margin-bottom:7.8pt;
	margin-left:0cm;
	text-align:center;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.3Char2, li.3Char2, div.3Char2
	{mso-style-name:"图中文字3 Char2";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	line-height:9.0pt;
	font-size:8.0pt;
	font-family:宋体;}
p.post2, li.post2, div.post2
	{mso-style-name:邮件post2;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:right;
	line-height:11.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.32, li.32, div.32
	{mso-style-name:图中字体32;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.5Char2, li.5Char2, div.5Char2
	{mso-style-name:"图中文字小5号 Char2";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
p.52, li.52, div.52
	{mso-style-name:图中文字小5号2;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
p.3CharCharCharChar, li.3CharCharCharChar, div.3CharCharCharChar
	{mso-style-name:"图中文字3 Char Char Char Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	line-height:9.0pt;
	font-size:8.0pt;
	font-family:宋体;}
p.130, li.130, div.130
	{mso-style-name:样式13;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.0pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.30, li.30, div.30
	{mso-style-name:代码程序3;
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:宋体;}
p.03, li.03, div.03
	{mso-style-name:封面03;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:36.0pt;
	font-family:宋体;
	font-weight:bold;}
p.131, li.131, div.131
	{mso-style-name:封面13;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:18.0pt;
	font-family:宋体;
	font-weight:bold;}
p.132, li.132, div.132
	{mso-style-name:非标题13;
	margin-top:7.8pt;
	margin-right:0cm;
	margin-bottom:7.8pt;
	margin-left:0cm;
	text-align:center;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.33, li.33, div.33
	{mso-style-name:文本居中3;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.3Char3, li.3Char3, div.3Char3
	{mso-style-name:"图中文字3 Char3";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	line-height:9.0pt;
	font-size:8.0pt;
	font-family:宋体;}
p.post3, li.post3, div.post3
	{mso-style-name:邮件post3;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:right;
	line-height:11.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.330, li.330, div.330
	{mso-style-name:图中字体33;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.5Char20, li.5Char20, div.5Char20
	{mso-style-name:"图中文字5号 Char2";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.5CharChar2, li.5CharChar2, div.5CharChar2
	{mso-style-name:"图中文字小5号 Char Char2";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
p.5Char3, li.5Char3, div.5Char3
	{mso-style-name:"图中文字小5号 Char3";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
p.53, li.53, div.53
	{mso-style-name:图中文字小5号3;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:9.0pt;
	font-family:宋体;}
p.3Char, li.3Char, div.3Char
	{mso-style-name:"图中文字3 Char";
	mso-style-link:"图中文字3 Char Char5";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	line-height:9.0pt;
	font-size:8.0pt;
	font-family:宋体;}
span.3CharChar5
	{mso-style-name:"图中文字3 Char Char5";
	mso-style-link:"图中文字3 Char";
	font-family:宋体;}
p.54, li.54, div.54
	{mso-style-name:图中文字小5紧密;
	margin:0cm;
	margin-bottom:.0001pt;
	line-height:9.0pt;
	text-autospace:ideograph-numeric;
	font-size:9.0pt;
	font-family:宋体;}
p.24, li.24, div.24
	{mso-style-name:居中2号粗宋体;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.15, li.15, div.15
	{mso-style-name:"样式 标题 1 + 居中";
	margin-top:17.0pt;
	margin-right:0cm;
	margin-bottom:16.5pt;
	margin-left:0cm;
	text-align:center;
	page-break-after:avoid;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.25, li.25, div.25
	{mso-style-name:"样式 标题 2 + 行距\: 单倍行距";
	margin-top:13.0pt;
	margin-right:0cm;
	margin-bottom:13.0pt;
	margin-left:28.9pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-28.9pt;
	page-break-after:avoid;
	font-size:16.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
span.2Char
	{mso-style-name:"标题 2 Char";
	mso-style-link:"标题 2";
	font-family:"Arial","sans-serif";
	font-weight:bold;}
p.34, li.34, div.34
	{mso-style-name:列表3;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.35, li.35, div.35
	{mso-style-name:表3;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.4, li.4, div.4
	{mso-style-name:图说明4;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.40, li.40, div.40
	{mso-style-name:列表4;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.0pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.0pt;
	font-size:10.5pt;
	font-family:宋体;}
p.41, li.41, div.41
	{mso-style-name:表4;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.55, li.55, div.55
	{mso-style-name:图说明5;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.56, li.56, div.56
	{mso-style-name:列表5;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.57, li.57, div.57
	{mso-style-name:表5;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.6, li.6, div.6
	{mso-style-name:列表6;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.60, li.60, div.60
	{mso-style-name:表6;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.61, li.61, div.61
	{mso-style-name:图说明6;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.7, li.7, div.7
	{mso-style-name:列表7;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.70, li.70, div.70
	{mso-style-name:图说明7;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.71, li.71, div.71
	{mso-style-name:表7;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.8, li.8, div.8
	{mso-style-name:列表8;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.9, li.9, div.9
	{mso-style-name:列表9;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.90, li.90, div.90
	{mso-style-name:图说明9;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.100, li.100, div.100
	{mso-style-name:列表10;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.101, li.101, div.101
	{mso-style-name:图说明10;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.114, li.114, div.114
	{mso-style-name:列表11;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.115, li.115, div.115
	{mso-style-name:图说明11;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.116, li.116, div.116
	{mso-style-name:表11;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.123, li.123, div.123
	{mso-style-name:列表12;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.124, li.124, div.124
	{mso-style-name:图说明12;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.133, li.133, div.133
	{mso-style-name:图说明13;
	mso-style-link:"图说明13 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
span.13Char
	{mso-style-name:"图说明13 Char";
	mso-style-link:图说明13;
	font-family:宋体;}
p.134, li.134, div.134
	{mso-style-name:列表13;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.26, li.26, div.26
	{mso-style-name:附录2;
	margin-top:13.0pt;
	margin-right:0cm;
	margin-bottom:13.0pt;
	margin-left:0cm;
	text-align:justify;
	text-justify:inter-ideograph;
	page-break-after:avoid;
	font-size:16.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
p.36, li.36, div.36
	{mso-style-name:附录3;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	page-break-after:avoid;
	font-size:14.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
span.3Char0
	{mso-style-name:"标题 3 Char";
	mso-style-link:"标题 3";
	font-family:"Arial","sans-serif";
	font-weight:bold;}
p.16, li.16, div.16
	{mso-style-name:附录1;
	margin-top:17.0pt;
	margin-right:0cm;
	margin-bottom:16.5pt;
	margin-left:0cm;
	text-align:center;
	page-break-after:avoid;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.17, li.17, div.17
	{mso-style-name:附录表1;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.42, li.42, div.42
	{mso-style-name:附录4;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	page-break-after:avoid;
	font-size:12.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
span.4Char
	{mso-style-name:"标题 4 Char";
	mso-style-link:"标题 4";
	font-family:"Arial","sans-serif";
	font-weight:bold;}
p.a3, li.a3, div.a3
	{mso-style-name:附录图说明;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.27, li.27, div.27
	{mso-style-name:序标题2;
	margin-top:13.0pt;
	margin-right:0cm;
	margin-bottom:13.0pt;
	margin-left:28.8pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-28.8pt;
	page-break-after:avoid;
	font-size:16.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
p.a4, li.a4, div.a4
	{mso-style-name:参考标题;
	margin-top:7.8pt;
	margin-right:0cm;
	margin-bottom:7.8pt;
	margin-left:0cm;
	text-align:center;
	page-break-after:avoid;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.18, li.18, div.18
	{mso-style-name:索引标题1;
	margin-top:7.8pt;
	margin-right:0cm;
	margin-bottom:7.8pt;
	margin-left:0cm;
	text-align:center;
	page-break-after:avoid;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.19, li.19, div.19
	{mso-style-name:列表1;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.25pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.25pt;
	font-size:10.5pt;
	font-family:宋体;}
p.1a, li.1a, div.1a
	{mso-style-name:表1;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.25pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.25pt;
	font-size:10.5pt;
	font-family:宋体;}
p.37, li.37, div.37
	{mso-style-name:图说明3;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.62, li.62, div.62
	{mso-style-name:表中字体6号;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	layout-grid-mode:char;
	font-size:7.5pt;
	font-family:宋体;}
p.a5, li.a5, div.a5
	{mso-style-name:正文代码;
	mso-style-link:"正文代码 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.Char1
	{mso-style-name:"正文代码 Char";
	mso-style-link:正文代码;
	font-family:宋体;}
p.43, li.43, div.43
	{mso-style-name:"样式 标题 4 +";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	page-break-after:avoid;
	font-size:12.0pt;
	font-family:"Arial","sans-serif";
	font-weight:bold;}
p.140, li.140, div.140
	{mso-style-name:表14;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.25pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.25pt;
	font-size:10.5pt;
	font-family:宋体;}
p.141, li.141, div.141
	{mso-style-name:图说明14;
	mso-style-link:"图说明14 Char";
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:21.25pt;
	margin-bottom:.0001pt;
	text-align:center;
	text-indent:-21.25pt;
	font-size:10.5pt;
	font-family:宋体;}
span.14Char
	{mso-style-name:"图说明14 Char";
	mso-style-link:图说明14;
	font-family:宋体;}
p.a6, li.a6, div.a6
	{mso-style-name:文件目录表;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.a7, li.a7, div.a7
	{mso-style-name:"样式 正文 +";
	mso-style-link:"样式 正文 + Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.Char2
	{mso-style-name:"样式 正文 + Char";
	mso-style-link:"样式 正文 +";
	font-family:"Times New Roman","serif";}
p.a8, li.a8, div.a8
	{mso-style-name:表格题注;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.a9, li.a9, div.a9
	{mso-style-name:列表题注;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.aa, li.aa, div.aa
	{mso-style-name:图题注;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.ab, li.ab, div.ab
	{mso-style-name:程序题注;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.ac, li.ac, div.ac
	{mso-style-name:框中文字;
	margin-top:0cm;
	margin-right:21.0pt;
	margin-bottom:0cm;
	margin-left:21.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	border:none;
	padding:0cm;
	font-size:9.0pt;
	font-family:宋体;}
p.125, li.125, div.125
	{mso-style-name:"样式 标题 1 + 居中2";
	margin-top:17.0pt;
	margin-right:0cm;
	margin-bottom:16.5pt;
	margin-left:0cm;
	text-align:center;
	page-break-after:avoid;
	font-size:22.0pt;
	font-family:宋体;
	font-weight:bold;}
p.ad, li.ad, div.ad
	{mso-style-name:"样式 题注 + 宋体 五号 居中";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:黑体;}
p.1b, li.1b, div.1b
	{mso-style-name:序标题1;
	margin-top:17.0pt;
	margin-right:0cm;
	margin-bottom:16.5pt;
	margin-left:0cm;
	line-height:240%;
	page-break-after:avoid;
	font-size:16.0pt;
	font-family:宋体;
	font-weight:bold;}
p.38, li.38, div.38
	{mso-style-name:序标题3;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	page-break-after:avoid;
	font-size:12.0pt;
	font-family:方正小标宋简体;}
p.63, li.63, div.63
	{mso-style-name:表中文字6号;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:7.5pt;
	font-family:宋体;}
p.64, li.64, div.64
	{mso-style-name:图中文字6号左对齐;
	margin:0cm;
	margin-bottom:.0001pt;
	line-height:10.0pt;
	layout-grid-mode:char;
	font-size:7.5pt;
	font-family:宋体;}
p.65, li.65, div.65
	{mso-style-name:图中文字6号;
	mso-style-link:"图中文字6号 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	line-height:10.0pt;
	layout-grid-mode:char;
	font-size:7.5pt;
	font-family:宋体;}
span.6Char
	{mso-style-name:"图中文字6号 Char";
	mso-style-link:图中文字6号;
	font-family:宋体;}
p.ae, li.ae, div.ae
	{mso-style-name:图标;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.28, li.28, div.28
	{mso-style-name:图标2;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
p.af, li.af, div.af
	{mso-style-name:习题标题;
	margin-top:6.0pt;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	page-break-after:avoid;
	font-size:14.0pt;
	font-family:黑体;}
p.1c, li.1c, div.1c
	{mso-style-name:部分编号1;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:16.0pt;
	font-family:宋体;}
p.af0, li.af0, div.af0
	{mso-style-name:表标题;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.af1, li.af1, div.af1
	{mso-style-name:"样式 题注 + 居中";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:宋体;}
p.ListTitle, li.ListTitle, div.ListTitle
	{mso-style-name:ListTitle;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.FigureTitle, li.FigureTitle, div.FigureTitle
	{mso-style-name:FigureTitle;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.TableTitle, li.TableTitle, div.TableTitle
	{mso-style-name:TableTitle;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.ProgramTitle, li.ProgramTitle, div.ProgramTitle
	{mso-style-name:ProgramTitle;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	font-size:10.5pt;
	font-family:"Arial","sans-serif";}
p.RightText, li.RightText, div.RightText
	{mso-style-name:RightText;
	margin-top:0cm;
	margin-right:21.0pt;
	margin-bottom:0cm;
	margin-left:42.0pt;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	border:none;
	padding:0cm;
	font-size:9.0pt;
	font-family:宋体;}
p.af2, li.af2, div.af2
	{mso-style-name:表中文字小五;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:9.0pt;
	font-family:宋体;}
p.af3, li.af3, div.af3
	{mso-style-name:关键词;
	mso-style-link:"关键词 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.Char3
	{mso-style-name:"关键词 Char";
	mso-style-link:关键词;
	font-family:宋体;}
p.af4, li.af4, div.af4
	{mso-style-name:文件名;
	mso-style-link:"文件名 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.Char4
	{mso-style-name:"文件名 Char";
	mso-style-link:文件名;
	font-family:宋体;}
p.af5, li.af5, div.af5
	{mso-style-name:选项;
	mso-style-link:"选项 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.Char5
	{mso-style-name:"选项 Char";
	mso-style-link:选项;
	font-family:宋体;}
p.af6, li.af6, div.af6
	{mso-style-name:命令行;
	mso-style-link:"命令行 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.Char6
	{mso-style-name:"命令行 Char";
	mso-style-link:命令行;
	font-family:宋体;}
p.af7, li.af7, div.af7
	{mso-style-name:函数名;
	mso-style-link:"函数名 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.Char7
	{mso-style-name:"函数名 Char";
	mso-style-link:函数名;
	font-family:宋体;}
p.af8, li.af8, div.af8
	{mso-style-name:寄存器名;
	mso-style-link:"寄存器名 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.Char8
	{mso-style-name:"寄存器名 Char";
	mso-style-link:寄存器名;
	font-family:"Times New Roman","serif";}
p.af9, li.af9, div.af9
	{mso-style-name:变量名;
	mso-style-link:"变量名 Char";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:宋体;}
span.Char9
	{mso-style-name:"变量名 Char";
	mso-style-link:变量名;
	font-family:宋体;}
p.58, li.58, div.58
	{mso-style-name:图中文字小5号左;
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:9.0pt;
	font-family:宋体;}
p.59, li.59, div.59
	{mso-style-name:图中文字小5号靠左;
	margin:0cm;
	margin-bottom:.0001pt;
	layout-grid-mode:char;
	font-size:9.0pt;
	font-family:宋体;}
p.926, li.926, div.926
	{mso-style-name:"样式 代码程序 + 左侧\:  9\.26 厘米";
	margin:0cm;
	margin-bottom:.0001pt;
	layout-grid-mode:char;
	font-size:10.0pt;
	font-family:宋体;}
span.5Char4
	{mso-style-name:"标题 5 Char";
	mso-style-link:"标题 5";
	font-weight:bold;}
span.6Char0
	{mso-style-name:"标题 6 Char";
	mso-style-link:"标题 6";
	font-family:"Arial","sans-serif";
	font-weight:bold;}
span.7Char
	{mso-style-name:"标题 7 Char";
	mso-style-link:"标题 7";
	font-weight:bold;}
span.8Char
	{mso-style-name:"标题 8 Char";
	mso-style-link:"标题 8";
	font-family:"Arial","sans-serif";}
span.9Char
	{mso-style-name:"标题 9 Char";
	mso-style-link:"标题 9";
	font-family:"Arial","sans-serif";}
span.Chara
	{mso-style-name:"脚注文本 Char";
	mso-style-link:脚注文本;
	font-family:宋体;}
span.Charb
	{mso-style-name:"批注文字 Char";
	mso-style-link:批注文字;
	font-family:宋体;}
span.Charc
	{mso-style-name:"页眉 Char";
	mso-style-link:页眉;
	font-family:宋体;}
span.Chard
	{mso-style-name:"页脚 Char";
	mso-style-link:页脚;
	font-family:宋体;}
span.Chare
	{mso-style-name:"日期 Char";
	mso-style-link:日期;
	font-family:宋体;}
span.HTMLChar
	{mso-style-name:"HTML 预设格式 Char\,HTML 预先格式化 Char\,HTML 预先格式化1 Char\,HTML 预先格式化2 Char\,HTML 预先格式化3 Char";
	mso-style-link:"HTML 预设格式\,HTML 预先格式化\,HTML 预先格式化1\,HTML 预先格式化2\,HTML 预先格式化3";
	font-family:宋体;}
span.Charf
	{mso-style-name:"批注主题 Char";
	mso-style-link:批注主题;
	font-family:宋体;
	font-weight:bold;}
span.Charf0
	{mso-style-name:"批注框文本 Char";
	mso-style-link:批注框文本;
	font-family:宋体;}
span.3CharChar1
	{mso-style-name:"图中文字3 Char Char1";
	font-family:宋体;}
span.5CharCharChar0
	{mso-style-name:"图中文字5号 Char Char Char";
	font-family:宋体;}
span.5CharCharChar1
	{mso-style-name:"图中文字小5号 Char Char Char1";
	font-family:宋体;}
span.3CharChar3
	{mso-style-name:"图中文字3 Char Char3";
	font-family:宋体;}
span.5CharChar10
	{mso-style-name:"图中文字5号 Char Char1";
	font-family:宋体;}
span.3CharCharChar1
	{mso-style-name:"图中文字3 Char Char Char1";
	font-family:宋体;}
span.3CharChar11
	{mso-style-name:"图中文字3 Char Char11";
	font-family:宋体;}
span.3CharChar2
	{mso-style-name:"图中文字3 Char Char2";
	font-family:宋体;}
span.5CharCharCharChar
	{mso-style-name:"图中文字小5号 Char Char Char Char";
	font-family:宋体;}
span.msoIns
	{mso-style-name:"";
	text-decoration:underline;
	color:teal;}
span.msoDel
	{mso-style-name:"";
	text-decoration:line-through;
	color:red;}
.MsoChpDefault
	{font-size:10.0pt;}
 /* Page Definitions */
 @page WordSection1
	{size:595.3pt 841.9pt;
	margin:72.0pt 54.0pt 72.0pt 54.0pt;
	layout-grid:15.6pt;}
div.WordSection1
	{page:WordSection1;}
 /* List Definitions */
 ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
-->
</style>

</head>

<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>

<div class=WordSection1 style='layout-grid:15.6pt'>

<p class=ab><a name="_Toc53320629"><span style='font-family:黑体'>程序</span><span
lang=EN-US>10-2 linux/kernel/chr_drv/console.c</span></a></p>

<div class=a align=center style='text-align:center'><span lang=EN-US>

<hr size=4 width="100%" align=center>

</span></div>

<p class=a><span lang=EN-US>&nbsp; <u><span style='color:blue'>1</span></u> <b><i>/*</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp; <u><span style='color:blue'>2</span></u> <b><i>&nbsp;*&nbsp;
linux/kernel/console.c</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp; <u><span style='color:blue'>3</span></u> <b><i>&nbsp;*</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp; <u><span style='color:blue'>4</span></u> <b><i>&nbsp;*&nbsp;
(C) 1991&nbsp; Linus Torvalds</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp; <u><span style='color:blue'>5</span></u> <b><i>&nbsp;*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp; <u><span style='color:blue'>6</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp; <u><span style='color:blue'>7</span></u> <b><i>/*</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp; <u><span style='color:blue'>8</span></u> <b><i>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
console.c</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp; <u><span style='color:blue'>9</span></u> <b><i>&nbsp;*</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>10</span></u> <b><i>&nbsp;*
This module implements the console io functions</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>11</span></u> <b><i>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
'void con_init(void)'</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>12</span></u> <b><i>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
'void con_write(struct tty_queue * queue)'</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>13</span></u> <b><i>&nbsp;*
Hopefully this will be a rather complete VT102 implementation.</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>14</span></u> <b><i>&nbsp;*</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>15</span></u> <b><i>&nbsp;*
Beeping thanks to John T Kohl.</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>16</span></u> <b><i>&nbsp;*
</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>17</span></u> <b><i>&nbsp;*
Virtual Consoles, Screen Blanking, Screen Dumping, Color, Graphics</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>18</span></u> <b><i>&nbsp;*&nbsp;&nbsp;
Chars, and VT100 enhancements by Peter MacDonald.</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>19</span></u> <b><i>&nbsp;*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; /*</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;
*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; console.c</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; *</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>该模块实现控制台输入输出功能</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp; 'void
con_init(void)'</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;
'void con_write(struct tty_queue * queue)'</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>希望这是一个非常完整的<span
lang=EN-US>VT102</span>实现。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; *</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>感谢<span
lang=EN-US>John T Kohl </span>实现了蜂鸣指示子程序。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; *</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>虚拟控制台、屏幕黑屏处理、屏幕拷贝、彩色处理、图形字符显示以及</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * VT100</span>终端增强操作由<span
lang=EN-US>Peter MacDonald</span>编制。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; */</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>20</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>21</span></u> <b><i>/*</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>22</span></u> <b><i>&nbsp;*&nbsp;
NOTE!!! We sometimes disable and enable interrupts for a short while</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>23</span></u> <b><i>&nbsp;*
(to put a word in video IO), but this will work even for keyboard</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>24</span></u> <b><i>&nbsp;*
interrupts. We know interrupts aren't enabled when getting a keyboard</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>25</span></u> <b><i>&nbsp;*
interrupt, as we use trap-gates. Hopefully all is well.</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>26</span></u> <b><i>&nbsp;*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; /*</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>注意<span
lang=EN-US>!!! </span>我们有时短暂地禁止和允许中断（当输出一个字<span lang=EN-US>(word) </span>到视频<span
lang=EN-US>IO</span>），但</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>即使对于键盘中断这也是可以工作的。因为我们使用陷阱门，所以我们知道在处理</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>一个键盘中断过程期间中断是被禁止的。希望一切均正常。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; */</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>27</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>28</span></u> <b><i>/*</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>29</span></u> <b><i>&nbsp;*
Code to check for different video-cards mostly by Galen Hunt,</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>30</span></u> <b><i>&nbsp;*
&lt;g-hunt@ee.utah.edu&gt;</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>31</span></u> <b><i>&nbsp;*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; /*</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>检测不同显示卡的大多数代码是<span
lang=EN-US>Galen Hunt</span>编写的，</p>

<p class=a><span lang=EN-US>&nbsp; &nbsp;&nbsp;&nbsp;*
&lt;g-hunt@ee.utah.edu&gt;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; */</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>32</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>33</span></u>
#include &lt;linux/sched.h&gt;&nbsp; // </span>调度程序头文件，定义任务结构<span lang=EN-US>task_struct</span>、任务<span
lang=EN-US>0</span>数据等。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>34</span></u>
#include &lt;linux/tty.h&gt;&nbsp;&nbsp;&nbsp; // tty</span>头文件，定义有关<span
lang=EN-US>tty_io</span>，串行通信方面的参数、常数。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>35</span></u>
#include &lt;linux/config.h&gt; // </span>内核配置头文件。定义硬盘类型（<span lang=EN-US>HD_TYPE</span>）可选项。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>36</span></u>
#include &lt;linux/kernel.h&gt; // </span>内核头文件。含有一些内核常用函数的原形定义。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>37</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>38</span></u>
#include &lt;asm/io.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // io</span>头文件。定义硬件端口输入<span
lang=EN-US>/</span>输出宏汇编语句。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>39</span></u>
#include &lt;asm/system.h&gt;&nbsp;&nbsp; // </span>系统头文件。定义设置或修改描述符<span
lang=EN-US>/</span>中断门等的汇编宏。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>40</span></u>
#include &lt;asm/segment.h&gt;&nbsp; // </span>段操作头文件。定义了有关段寄存器操作的嵌入式汇编函数。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>41</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>42</span></u>
#include &lt;string.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </span>字符串头文件。主要定义了一些有关字符串操作的嵌入函数。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>43</span></u>
#include &lt;errno.h&gt;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;// </span>错误号头文件。包含系统中各种出错号。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>44</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>该符号常量定义终端<span
lang=EN-US>IO</span>结构的默认数据。其中符号常数请参照<span lang=EN-US>include/termios.h</span>文件。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>45</span></u>
#define <u><span style='color:blue'>DEF_TERMIOS</span></u> \</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>46</span></u>
(struct <u><span style='color:blue'>termios</span></u>) { \</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>47</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>ICRNL</span></u>, \</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>48</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>OPOST</span></u> | <u><span style='color:blue'>ONLCR</span></u>,
\</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>49</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0, \</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>50</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>IXON</span></u> | <u><span style='color:blue'>ISIG</span></u>
| <u><span style='color:blue'>ICANON</span></u> | <u><span style='color:blue'>ECHO</span></u>
| <u><span style='color:blue'>ECHOCTL</span></u> | <u><span style='color:blue'>ECHOKE</span></u>,
\</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>51</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0, \</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>52</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>INIT_C_CC</span></u> \</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>53</span></u> }</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>54</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>55</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>56</span></u> <b><i>/*</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>57</span></u> <b><i>&nbsp;*
These are set up by the setup-routine at boot-time:</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>58</span></u> <b><i>&nbsp;*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; /*</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>这些是<span
lang=EN-US>setup</span>程序在引导启动系统时设置的参数：</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; */</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参见对<span lang=EN-US>boot/setup.s</span>的注释和<span
lang=EN-US>setup</span>程序读取并保留的系统参数表。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>59</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>60</span></u>
#define <u><span style='color:blue'>ORIG_X</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(*(unsigned char *)0x90000)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </span>初始光标列号。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>61</span></u>
#define <u><span style='color:blue'>ORIG_Y</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(*(unsigned char *)0x90001)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </span>初始光标行号。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>62</span></u>
#define <u><span style='color:blue'>ORIG_VIDEO_PAGE</span></u>&nbsp;&nbsp;
(*(unsigned short *)0x90004)&nbsp;&nbsp;&nbsp;&nbsp; // </span>初始显示页面。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>63</span></u>
#define <u><span style='color:blue'>ORIG_VIDEO_MODE</span></u>&nbsp;&nbsp; ((*(unsigned
short *)0x90006) &amp; 0xff) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//
</span>显示模式。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>64</span></u>
#define <u><span style='color:blue'>ORIG_VIDEO_COLS</span></u>&nbsp;&nbsp;
(((*(unsigned short *)0x90006) &amp; 0xff00) &gt;&gt; 8) // </span>屏幕列数。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>65</span></u>
#define <u><span style='color:blue'>ORIG_VIDEO_LINES</span></u>&nbsp;
((*(unsigned short *)0x9000e) &amp; 0xff)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>屏幕行数。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>66</span></u>
#define <u><span style='color:blue'>ORIG_VIDEO_EGA_AX</span></u> (*(unsigned
short *)0x90008)&nbsp;&nbsp;&nbsp;&nbsp; // [??]</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>67</span></u>
#define <u><span style='color:blue'>ORIG_VIDEO_EGA_BX</span></u> (*(unsigned
short *)0x9000a)&nbsp; &nbsp;&nbsp;&nbsp;// </span>显示内存大小和色彩模式。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>68</span></u>
#define <u><span style='color:blue'>ORIG_VIDEO_EGA_CX</span></u> (*(unsigned
short *)0x9000c)&nbsp;&nbsp;&nbsp;&nbsp; // </span>显示卡特性参数。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>69</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>定义显示器单色<span
lang=EN-US>/</span>彩色显示模式类型符号常数。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>70</span></u>
#define <u><span style='color:blue'>VIDEO_TYPE_MDA</span></u>&nbsp;&nbsp;&nbsp;
0x10&nbsp;&nbsp;&nbsp; <b><i>/* Monochrome Text Display&nbsp;&nbsp;&nbsp;&nbsp;
*/</i></b>&nbsp; /* </span>单色文本<span lang=EN-US>&nbsp;&nbsp; */</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>71</span></u>
#define <u><span style='color:blue'>VIDEO_TYPE_CGA</span></u>&nbsp;&nbsp;&nbsp;
0x11&nbsp;&nbsp;&nbsp; <b><i>/* CGA
Display&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*/</i></b>&nbsp; /* CGA</span>显示器<span lang=EN-US>&nbsp; */</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>72</span></u>
#define <u><span style='color:blue'>VIDEO_TYPE_EGAM</span></u>&nbsp;&nbsp;
0x20&nbsp;&nbsp;&nbsp; <b><i>/* EGA/VGA in Monochrome Mode&nbsp; */</i></b>&nbsp;
/* EGA/VGA</span>单色<span lang=EN-US>*/</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>73</span></u>
#define <u><span style='color:blue'>VIDEO_TYPE_EGAC</span></u>&nbsp;&nbsp;
0x21&nbsp;&nbsp;&nbsp; <b><i>/* EGA/VGA in Color
Mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</i></b>&nbsp; /* EGA/VGA</span>彩色<span
lang=EN-US>*/</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>74</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>75</span></u>
#define <u><span style='color:blue'>NPAR</span></u> 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>转义字符序列中最大参数个数。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>76</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>77</span></u> int
<u><span style='color:blue'>NR_CONSOLES</span></u> = 0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//
</span>系统实际支持的虚拟控制台数量。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>78</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>79</span></u>
extern void <u><span style='color:blue'>keyboard_interrupt</span></u>(void);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>键盘中断处理程序（<span lang=EN-US>keyboard.S</span>）。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>80</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>以下这些静态变量是本文件函数中使用的一些全局变量。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //
video_type;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>使用的显示类型；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //
video_num_columns;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>屏幕文本列数；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //
video_mem_base;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>物理显示内存基地址；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //
video_mem_term;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>物理显示内存末端地址；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //
video_size_row;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>屏幕每行使用的字节数；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //
video_num_lines;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>屏幕文本行数；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //
video_page;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>初试显示页面；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //
video_port_reg;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>显示控制选择寄存器端口；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //
video_port_val;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>显示控制数据寄存器端口。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>81</span></u>
static unsigned char&nbsp;&nbsp;&nbsp; <u><span style='color:blue'>video_type</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><i>/* Type of display being used&nbsp;&nbsp;
*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>82</span></u>
static unsigned long&nbsp;&nbsp;&nbsp; <u><span style='color:blue'>video_num_columns</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* Number of text columns&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>83</span></u>
static unsigned long&nbsp;&nbsp;&nbsp; <u><span style='color:blue'>video_mem_base</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* Base of video memory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>84</span></u>
static unsigned long&nbsp;&nbsp;&nbsp; <u><span style='color:blue'>video_mem_term</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* End of video
memory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>85</span></u>
static unsigned long&nbsp;&nbsp;&nbsp; <u><span style='color:blue'>video_size_row</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* Bytes per
row&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>86</span></u>
static unsigned long&nbsp;&nbsp;&nbsp; <u><span style='color:blue'>video_num_lines</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* Number of test lines&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>87</span></u>
static unsigned char&nbsp;&nbsp;&nbsp; <u><span style='color:blue'>video_page</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* Initial video
page&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>88</span></u>
static unsigned short&nbsp;&nbsp; <u><span style='color:blue'>video_port_reg</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* Video register select port&nbsp;&nbsp; */</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>89</span></u>
static unsigned short&nbsp;&nbsp; <u><span style='color:blue'>video_port_val</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* Video register value port&nbsp;&nbsp;&nbsp; */</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>90</span></u>
static int <u><span style='color:blue'>can_do_colour</span></u> = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>标志：可使用彩色功能。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>91</span></u> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>虚拟控制台结构。其中包含一个虚拟控制台的当前所有信息。其中<span
lang=EN-US>vc_origin</span>和<span lang=EN-US>vc_scr_end</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>是当前正在处理的虚拟控制台执行快速滚屏操作时使用的起始行和末行对应的显示内存位置。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // vc_video_mem_start</span>和<span
lang=EN-US>vc_video_mem_end</span>是当前虚拟控制台使用的显示内存区域部分。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // vc -- Virtual Console</span>。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>92</span></u>
static struct {</span></p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>93</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
unsigned short&nbsp; vc_video_erase_char;&nbsp;&nbsp;&nbsp; // </span>擦除字符属性及字符（<span
lang=EN-US>0x0720</span>）</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>94</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
unsigned char&nbsp;&nbsp; vc_attr;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>字符属性。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>95</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
unsigned char&nbsp;&nbsp; vc_def_attr;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>默认字符属性。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>96</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
vc_bold_attr;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </span>粗体字符属性。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>97</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
unsigned long&nbsp;&nbsp; vc_ques;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>问号字符。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>98</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
unsigned long&nbsp;&nbsp; vc_state;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>处理转义或控制序列的当前状态。</p>

<p class=a><span lang=EN-US>&nbsp;<u><span style='color:blue'>99</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
unsigned long&nbsp;&nbsp; vc_restate;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>处理转义或控制序列的下一状态。</p>

<p class=a><u><span lang=EN-US style='color:blue'>100</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
long&nbsp;&nbsp; vc_checkin;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>101</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
long&nbsp;&nbsp;
vc_origin;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* Used for EGA/VGA fast scroll */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>102</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
long&nbsp;&nbsp;
vc_scr_end;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* Used for EGA/VGA fast scroll */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>103</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
long&nbsp;&nbsp; vc_pos;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>当前光标对应的显示内存位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>104</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
long&nbsp;&nbsp; vc_x,vc_y;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>当前光标列、行值。</p>

<p class=a><u><span lang=EN-US style='color:blue'>105</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
long&nbsp;&nbsp; vc_top,vc_bottom;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </span>滚动时顶行行号；底行行号。</p>

<p class=a><u><span lang=EN-US style='color:blue'>106</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
long&nbsp;&nbsp; vc_npar,vc_par[<u><span style='color:blue'>NPAR</span></u>];&nbsp;&nbsp;
// </span>转义序列参数个数和参数数组。</p>

<p class=a><u><span lang=EN-US style='color:blue'>107</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
long&nbsp;&nbsp; vc_video_mem_start;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/* Start of video
RAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>108</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
long&nbsp;&nbsp; vc_video_mem_end;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/*
End of video RAM (sort of)&nbsp;&nbsp; */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>109</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
int&nbsp;&nbsp;&nbsp; vc_saved_x;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>保存的光标列号。</p>

<p class=a><u><span lang=EN-US style='color:blue'>110</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
int&nbsp;&nbsp;&nbsp; vc_saved_y;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>保存的光标行号。</p>

<p class=a><u><span lang=EN-US style='color:blue'>111</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned
int&nbsp;&nbsp;&nbsp; vc_iscolor;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>彩色显示标志。</p>

<p class=a><u><span lang=EN-US style='color:blue'>112</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char
*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vc_translate;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>使用的字符集。</p>

<p class=a><u><span lang=EN-US style='color:blue'>113</span></u><span
lang=EN-US> } <u><span style='color:blue'>vc_cons</span></u> [<u><span
style='color:blue'>MAX_CONSOLES</span></u>];</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>114</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>为了便于引用，以下定义当前正在处理控制台信息的符号。含义同上。其中<span
lang=EN-US>currcons</span>是使用</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // vc_cons[]</span>结构的函数参数中的当前虚拟终端号。</p>

<p class=a><u><span lang=EN-US style='color:blue'>115</span></u><span
lang=EN-US> #define <u><span style='color:blue'>origin</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_origin)&nbsp; // </span>快速滚屏操作起始内存位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>116</span></u><span
lang=EN-US> #define <u><span style='color:blue'>scr_end</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_scr_end) // </span>快速滚屏操作末端内存位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>117</span></u><span
lang=EN-US> #define <u><span style='color:blue'>pos</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_pos)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>118</span></u><span
lang=EN-US> #define <u><span style='color:blue'>top</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_top)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>119</span></u><span
lang=EN-US> #define <u><span style='color:blue'>bottom</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_bottom)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>120</span></u><span
lang=EN-US> #define <u><span style='color:blue'>x</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_x)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>121</span></u><span
lang=EN-US> #define <u><span style='color:blue'>y</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_y)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>122</span></u><span
lang=EN-US> #define <u><span style='color:blue'>state</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_state)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>123</span></u><span
lang=EN-US> #define <u><span style='color:blue'>restate</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_restate)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>124</span></u><span
lang=EN-US> #define <u><span style='color:blue'>checkin</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_checkin)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>125</span></u><span
lang=EN-US> #define <u><span style='color:blue'>npar</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_npar)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>126</span></u><span
lang=EN-US> #define <u><span style='color:blue'>par</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_par)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>127</span></u><span
lang=EN-US> #define <u><span style='color:blue'>ques</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_ques)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>128</span></u><span
lang=EN-US> #define <u><span style='color:blue'>attr</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_attr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>129</span></u><span
lang=EN-US> #define <u><span style='color:blue'>saved_x</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_saved_x)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>130</span></u><span
lang=EN-US> #define <u><span style='color:blue'>saved_y</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_saved_y)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>131</span></u><span
lang=EN-US> #define <u><span style='color:blue'>translate</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_translate)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>132</span></u><span
lang=EN-US> #define <u><span style='color:blue'>video_mem_start</span></u> (<u><span
style='color:blue'>vc_cons</span></u>[currcons].vc_video_mem_start)&nbsp; // </span>使用显存的起始位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>133</span></u><span
lang=EN-US> #define <u><span style='color:blue'>video_mem_end</span></u>&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_video_mem_end)&nbsp;&nbsp;&nbsp;
// </span>使用显存的末端位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>134</span></u><span
lang=EN-US> #define <u><span style='color:blue'>def_attr</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_def_attr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>135</span></u><span
lang=EN-US> #define <u><span style='color:blue'>video_erase_char</span></u>&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_video_erase_char)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>136</span></u><span
lang=EN-US> #define <u><span style='color:blue'>iscolor</span></u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_iscolor)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>137</span></u><span
lang=EN-US> </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>138</span></u><span
lang=EN-US> int <u><span style='color:blue'>blankinterval</span></u> = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设定的屏幕黑屏间隔时间。</p>

<p class=a><u><span lang=EN-US style='color:blue'>139</span></u><span
lang=EN-US> int <u><span style='color:blue'>blankcount</span></u> = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>黑屏时间计数。</p>

<p class=a><u><span lang=EN-US style='color:blue'>140</span></u><span
lang=EN-US> </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>141</span></u><span
lang=EN-US> static void <u><span style='color:blue'>sysbeep</span></u>(void);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>系统蜂鸣函数。</p>

<p class=a><u><span lang=EN-US style='color:blue'>142</span></u><span
lang=EN-US> </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>143</span></u><span
lang=EN-US> <b><i>/*</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>144</span></u><span
lang=EN-US> <b><i>&nbsp;* this is what the terminal answers to a ESC-Z or csi0c</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>145</span></u><span
lang=EN-US> <b><i>&nbsp;* query (= vt100 response).</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>146</span></u><span
lang=EN-US> <b><i>&nbsp;*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; /*</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>下面是终端回应<span
lang=EN-US>ESC-Z</span>或<span lang=EN-US>csi0c</span>请求的应答（<span
lang=EN-US>=vt100</span>响应）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; */</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // csi - </span>控制序列引导码<span
lang=EN-US>(Control Sequence Introducer)</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>主机通过发送不带参数或参数是<span
lang=EN-US>0</span>的设备属性（<span lang=EN-US>DA</span>）控制序列（ <span lang=EN-US>'ESC
[c' </span>或 <span lang=EN-US>'ESC [0c' </span>）</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>要求终端应答一个设备属性控制序列（<span
lang=EN-US>ESC Z</span>的作用与此相同），终端则发送以下序列来响应</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>主机。该序列（即 <span
lang=EN-US>'ESC [?1;2c' </span>）表示终端是具有高级视频功能的<span
lang=EN-US>VT100</span>兼容终端。</p>

<p class=a><u><span lang=EN-US style='color:blue'>147</span></u><span
lang=EN-US> #define <u><span style='color:blue'>RESPONSE</span></u> <i>&quot;\033[?1;2c&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>148</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>定义使用的字符集。其中上半部分时普通<span
lang=EN-US>7</span>比特<span lang=EN-US>ASCII</span>代码，即<span lang=EN-US>US</span>字符集。下半部分对应</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // VT100</span>终端设备中的线条字符，即显示图表线条的字符集。</p>

<p class=a><u><span lang=EN-US style='color:blue'>149</span></u><span
lang=EN-US> static char * <u><span style='color:blue'>translations</span></u>[]
= {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>150</span></u><span
lang=EN-US> <b><i>/* normal 7-bit ascii */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>151</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>&quot;
!\&quot;#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>152</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>&quot;@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>153</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>&quot;`abcdefghijklmnopqrstuvwxyz{|}~
&quot;</i>,</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>154</span></u><span
lang=EN-US> <b><i>/* vt100 graphics */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>155</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>&quot;
!\&quot;#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>156</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>&quot;@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^
&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>157</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>&quot;\004\261\007\007\007\007\370\361\007\007\275\267\326\323\327\304&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>158</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>&quot;\304\304\304\304\307\266\320\322\272\363\362\343\\007\234\007
&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>159</span></u><span
lang=EN-US> };</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>160</span></u><span
lang=EN-US> </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>161</span></u><span
lang=EN-US> #define <u><span style='color:blue'>NORM_TRANS</span></u> (<u><span
style='color:blue'>translations</span></u>[0])</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>162</span></u><span
lang=EN-US> #define <u><span style='color:blue'>GRAF_TRANS</span></u> (<u><span
style='color:blue'>translations</span></u>[1])</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>163</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>跟踪光标当前位置。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数：<span lang=EN-US>currcons
- </span>当前虚拟终端号；<span lang=EN-US>new_x - </span>光标所在列号；<span lang=EN-US>new_y
- </span>光标所在行号。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>更新当前光标位置变量 <span
lang=EN-US>x,y</span>，并修正光标在显示内存中的对应位置 <span lang=EN-US>pos</span>。该函数会首先检查</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数的有效性。如果给定的光标列号超出显示器最大列数，或者光标行号不低于显示的最大</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>行数，则退出。否则就更新当前光标变量和新光标位置对应在显示内存中位置<span
lang=EN-US>pos</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>注意，函数中的所有变量实际上是<span
lang=EN-US>vc_cons[currcons]</span>结构中的相应字段。以下函数相同。</p>

<p class=a><u><span lang=EN-US style='color:blue'>164</span></u><span
lang=EN-US> <b><i>/* NOTE! gotoxy thinks x==video_num_columns is ok */</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; /* </span>注意！<span lang=EN-US>gotoxy</span>函数认为
<span lang=EN-US>x==video_num_columns </span>时是正确的<span lang=EN-US> */</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>165</span></u><span
lang=EN-US> static inline void <u><span style='color:blue'>gotoxy</span></u>(int
currcons, int new_x,unsigned int new_y)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>166</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>167</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (new_x &gt; <u><span
style='color:blue'>video_num_columns</span></u> || new_y &gt;= <u><span
style='color:blue'>video_num_lines</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>168</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>169</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>x</span></u> = new_x;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>170</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>y</span></u> = new_y;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>171</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>pos</span></u> = <u><span style='color:blue'>origin</span></u>
+ <u><span style='color:blue'>y</span></u>*<u><span style='color:blue'>video_size_row</span></u>
+ (<u><span style='color:blue'>x</span></u>&lt;&lt;1);&nbsp;&nbsp; // 1</span>列用<span
lang=EN-US>2</span>个字节表示，所以<span lang=EN-US>x&lt;&lt;1</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>172</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>173</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>设置滚屏起始显示内存地址。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>再次提醒，函数中变量基本上都是<span
lang=EN-US> vc_cons[currcons] </span>结构中的相应字段。</p>

<p class=a><u><span lang=EN-US style='color:blue'>174</span></u><span
lang=EN-US> static inline void <u><span style='color:blue'>set_origin</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>175</span></u><span
lang=EN-US> {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>首先判断显示卡类型。 对于<span
lang=EN-US> EGA/VGA </span>卡，我们可以指定屏内行范围（区域）进行滚屏操作，</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>而<span lang=EN-US>MDA</span>单色显示卡只能进行整屏滚屏操作。因此只有<span
lang=EN-US> EGA/VGA </span>卡才需要设置滚屏起始行显示</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>内存地址（起始行是 <span
lang=EN-US>origin </span>对应的行）。即显示类型如果不是<span lang=EN-US> EGA/VGA </span>彩色模式，也不是</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // EGA/VGA</span>单色模式，那么就直接返回。另外，我们只对前台控制台进行操作，因此当前控制台</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // currcons</span>必须是前台控制台时，我们才需要设置其滚屏起始行对应的内存起点位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>176</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>video_type</span></u> != <u><span style='color:blue'>VIDEO_TYPE_EGAC</span></u>
&amp;&amp; <u><span style='color:blue'>video_type</span></u> != <u><span
style='color:blue'>VIDEO_TYPE_EGAM</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>177</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>178</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (currcons != <u><span
style='color:blue'>fg_console</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>179</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后向显示寄存器选择端口<span
lang=EN-US>video_port_reg</span>输出<span lang=EN-US>12</span>，即选择显示控制数据寄存器<span
lang=EN-US>r12</span>，接着</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>写入滚屏起始地址高字节。其中向右移动<span
lang=EN-US>9</span>位，实际上表示向右移动<span lang=EN-US>8</span>位再除以<span lang=EN-US>2</span>（屏幕上<span
lang=EN-US>1</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>个字符用<span lang=EN-US>2</span>字节表示）。再选择显示控制数据寄存器<span
lang=EN-US>r13</span>，然后写入滚屏起始地址低字节。向</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>右移动<span lang=EN-US>1</span>位表示除以<span
lang=EN-US>2</span>，同样代表屏幕上<span lang=EN-US>1</span>个字符用<span lang=EN-US>2</span>字节表示。输出值相对于默认显示内存</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>起始位置<span lang=EN-US>video_mem_base</span>进行操作，例如对于
<span lang=EN-US>EGA/VGA </span>彩色模式，<span lang=EN-US>viedo_mem_base = </span>物理</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>内存地址<span lang=EN-US>0xb8000</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>180</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>cli</span></u>();</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>181</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(12, <u><span style='color:blue'>video_port_reg</span></u>);&nbsp;&nbsp;&nbsp;
// </span>选择数据寄存器<span lang=EN-US>r12</span>，输出滚屏起始位置高字节。</p>

<p class=a><u><span lang=EN-US style='color:blue'>182</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(0xff&amp;((<u><span style='color:blue'>origin</span></u>-<u><span
style='color:blue'>video_mem_base</span></u>)&gt;&gt;9), <u><span
style='color:blue'>video_port_val</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>183</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(13, <u><span style='color:blue'>video_port_reg</span></u>);&nbsp;&nbsp;&nbsp;
// </span>选择数据寄存器<span lang=EN-US>r13</span>，输出滚屏起始位置低字节。</p>

<p class=a><u><span lang=EN-US style='color:blue'>184</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(0xff&amp;((<u><span style='color:blue'>origin</span></u>-<u><span
style='color:blue'>video_mem_base</span></u>)&gt;&gt;1), <u><span
style='color:blue'>video_port_val</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>185</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>sti</span></u>();</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>186</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>187</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>向上卷动一行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>将屏幕滚动窗口向下移动一行，并在屏幕滚动区域底出现的新行上添加空格字符。滚屏区域</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>必须大于<span lang=EN-US>1</span>行。参见程序列表后说明。</p>

<p class=a><u><span lang=EN-US style='color:blue'>188</span></u><span
lang=EN-US> static void <u><span style='color:blue'>scrup</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>189</span></u><span
lang=EN-US> {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>滚屏区域必须起码有<span
lang=EN-US>2</span>行。如果滚屏区域顶行号大于等于区域底行号，则不满足进行滚行操作</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>的条件。另外，对于<span
lang=EN-US>EGA/VGA</span>卡，我们可以指定屏内行范围（区域）进行滚屏操作，而<span lang=EN-US>MDA</span>单</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>色显示卡只能进行整屏滚屏操作。该函数对<span
lang=EN-US>EGA</span>和<span lang=EN-US>MDA</span>显示类型进行分别处理。如果显示类型</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>是<span lang=EN-US> EGA</span>，则还分为整屏窗口移动和区域内窗口移动。这里首先处理显示卡是<span
lang=EN-US>EGA/VGA</span>显示类型</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>的情况。</p>

<p class=a><u><span lang=EN-US style='color:blue'>190</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>bottom</span></u>&lt;=<u><span style='color:blue'>top</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>191</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>192</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>video_type</span></u> == <u><span style='color:blue'>VIDEO_TYPE_EGAC</span></u>
|| <u><span style='color:blue'>video_type</span></u> == <u><span
style='color:blue'>VIDEO_TYPE_EGAM</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>193</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果移动起始行<span
lang=EN-US>top=0</span>，移动最底行 <span lang=EN-US>bottom = video_num_lines = 25</span>，则表示整屏窗口向下</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>移动。于是把整个屏幕窗口左上角对应的起始内存位置<span
lang=EN-US>origin </span>调整为向下移一行对应的内存</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>位置，同时也跟踪调整当前光标对应的内存位置以及屏幕末行末端字符指针<span
lang=EN-US>scr_end</span>的位置。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>最后把新屏幕窗口内存起始位置值<span
lang=EN-US>origin</span>写入显示控制器中。</p>

<p class=a><u><span lang=EN-US style='color:blue'>194</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>top</span></u> &amp;&amp; <u><span
style='color:blue'>bottom</span></u> == <u><span style='color:blue'>video_num_lines</span></u>)
{</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>195</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>origin</span></u> += <u><span style='color:blue'>video_size_row</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>196</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> += <u><span style='color:blue'>video_size_row</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>197</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>scr_end</span></u> += <u><span style='color:blue'>video_size_row</span></u>;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果屏幕窗口末端所对应的显示内存指针<span
lang=EN-US>scr_end </span>超出了实际显示内存末端，则将屏幕内容</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>除第一行以外所有行对应的内存数据移动到显示内存的起始位置<span
lang=EN-US>video_mem_start</span>处，并在</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>整屏窗口向下移动出现的新行上填入空格字符。然后根据屏幕内存数据移动后的情况，重新</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>调整当前屏幕对应内存的起始指针、光标位置指针和屏幕末端对应内存指针<span
lang=EN-US>scr_end</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>这段嵌入汇编程序首先将（屏幕字符行数<span
lang=EN-US> - 1</span>）行对应的内存数据移动到显示内存起始位置</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // video_mem_start</span>处，然后在随后的内存位置处添加一行空格（擦除）字符数据。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // %0 -eax(</span>擦除字符<span
lang=EN-US>+</span>属性<span lang=EN-US>)</span>；<span lang=EN-US>%1 -ecx</span>（<span
lang=EN-US>(</span>屏幕字符行数<span lang=EN-US>-1)</span>所对应的字符数<span lang=EN-US>/2</span>，以长字移动）；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // %2 -edi(</span>显示内存起始位置<span
lang=EN-US>video_mem_start)</span>；<span lang=EN-US>%3 -esi(</span>屏幕窗口内存起始位置<span
lang=EN-US>origin)</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>移动方向：<span lang=EN-US>[edi]</span><span
lang=EN-US style='font-family:Wingdings'>è</span><span lang=EN-US>[esi]</span>，移动<span
lang=EN-US>ecx</span>个长字。</p>

<p class=a><u><span lang=EN-US style='color:blue'>198</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>scr_end</span></u> &gt; <u><span
style='color:blue'>video_mem_end</span></u>) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>199</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__asm__(<i>&quot;cld\n\t&quot;</i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// </span>清方向位。</p>

<p class=a><u><span lang=EN-US style='color:blue'>200</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// </span>重复操作，将当前屏幕内存</p>

<p class=a><u><span lang=EN-US style='color:blue'>201</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movsl\n\t&quot;</i> &nbsp;&nbsp;&nbsp;&nbsp;// </span>数据移动到显示内存起始处。</p>

<p class=a><u><span lang=EN-US style='color:blue'>202</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movl _video_num_columns,%1\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>203</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// </span>在新行上填入空格字符。</p>

<p class=a><u><span lang=EN-US style='color:blue'>204</span></u><span
lang=EN-US>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>&quot;stosw&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>205</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::<i>&quot;a&quot;</i> (<u><span style='color:blue'>video_erase_char</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>206</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;c&quot;</i> ((<u><span style='color:blue'>video_num_lines</span></u>-1)*<u><span
style='color:blue'>video_num_columns</span></u>&gt;&gt;1),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>207</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;D&quot;</i> (<u><span style='color:blue'>video_mem_start</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>208</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;S&quot;</i> (<u><span style='color:blue'>origin</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>209</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;cx&quot;</i>,<i>&quot;di&quot;</i>,<i>&quot;si&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>210</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>scr_end</span></u> -= <u><span style='color:blue'>origin</span></u>-<u><span
style='color:blue'>video_mem_start</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>211</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> -= <u><span style='color:blue'>origin</span></u>-<u><span
style='color:blue'>video_mem_start</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>212</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>origin</span></u> = <u><span style='color:blue'>video_mem_start</span></u>;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果调整后的屏幕末端对应的内存指针<span
lang=EN-US>scr_end </span>没有超出显示内存的末端 <span lang=EN-US>video_mem_end</span>，</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>则只需在新行上填入擦除字符（空格字符）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // %0 -eax(</span>擦除字符<span
lang=EN-US>+</span>属性<span lang=EN-US>)</span>；<span lang=EN-US>%1 -ecx(</span>屏幕行数<span
lang=EN-US>)</span>；<span lang=EN-US>%2 - edi</span>（最后<span lang=EN-US>1</span>行开始处对应内存位置）；</p>

<p class=a><u><span lang=EN-US style='color:blue'>213</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} else {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>214</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__asm__(<i>&quot;cld\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>215</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </span>重复操作，在新出现行上</p>

<p class=a><u><span lang=EN-US style='color:blue'>216</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;stosw&quot;</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </span>填入擦除字符<span
lang=EN-US>(</span>空格字符<span lang=EN-US>)</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>217</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::<i>&quot;a&quot;</i>
(<u><span style='color:blue'>video_erase_char</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>218</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;c&quot;</i> (<u><span style='color:blue'>video_num_columns</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>219</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;D&quot;</i> (<u><span style='color:blue'>scr_end</span></u>-<u><span
style='color:blue'>video_size_row</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>220</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;cx&quot;</i>,<i>&quot;di&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>221</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后把新屏幕滚动窗口内存起始位置值<span
lang=EN-US>origin</span>写入显示控制器中。</p>

<p class=a><u><span lang=EN-US style='color:blue'>222</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>set_origin</span></u>(currcons);</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>否则表示不是整屏移动。即表示从指定行<span
lang=EN-US>top</span>开始到<span lang=EN-US>bottom</span>区域中的所有行向上移动<span
lang=EN-US>1</span>行，</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>指定行<span lang=EN-US>top</span>被删除。此时直接将屏幕从指定行<span
lang=EN-US>top</span>到屏幕末端所有行对应的显示内存数据向</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>上移动<span lang=EN-US>1</span>行，并在最下面新出现的行上填入擦除字符。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // %0 - eax(</span>擦除字符<span
lang=EN-US>+</span>属性<span lang=EN-US>)</span>；<span lang=EN-US>%1 - ecx(top</span>行下<span
lang=EN-US>1</span>行开始到<span lang=EN-US>bottom</span>行所对应的内存长字数<span
lang=EN-US>)</span>；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // %2 - edi(top</span>行所处的内存位置<span
lang=EN-US>)</span>；<span lang=EN-US>%3 - esi(top+1</span>行所处的内存位置<span
lang=EN-US>)</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>223</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} else {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>224</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__asm__(<i>&quot;cld\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>225</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// </span>循环操作，将<span
lang=EN-US>top+1</span>到<span lang=EN-US>bottom</span>行</p>

<p class=a><u><span lang=EN-US style='color:blue'>226</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movsl\n\t&quot;</i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// </span>所对应的内存块移到<span
lang=EN-US>top</span>行开始处。</p>

<p class=a><u><span lang=EN-US style='color:blue'>227</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movl _video_num_columns,%%ecx\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>228</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// </span>在新行上填入擦除字符。</p>

<p class=a><u><span lang=EN-US style='color:blue'>229</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;stosw&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>230</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::<i>&quot;a&quot;</i> (<u><span style='color:blue'>video_erase_char</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>231</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;c&quot;</i> ((<u><span style='color:blue'>bottom</span></u>-<u><span
style='color:blue'>top</span></u>-1)*<u><span style='color:blue'>video_num_columns</span></u>&gt;&gt;1),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>232</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;D&quot;</i> (<u><span style='color:blue'>origin</span></u>+<u><span
style='color:blue'>video_size_row</span></u>*<u><span style='color:blue'>top</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>233</span></u><span
lang=EN-US>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>&quot;S&quot;</i>
(<u><span style='color:blue'>origin</span></u>+<u><span style='color:blue'>video_size_row</span></u>*(<u><span
style='color:blue'>top</span></u>+1))</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>234</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;cx&quot;</i>,<i>&quot;di&quot;</i>,<i>&quot;si&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>235</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>236</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果显示类型不是<span
lang=EN-US>EGA</span>（而是<span lang=EN-US>MDA </span>），则执行下面移动操作。因为<span
lang=EN-US>MDA</span>显示控制卡只能整屏滚</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>动，并且会自动调整超出显示范围的情况，即会自动翻卷指针，所以这里不对屏幕内容对应内</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>存超出显示内存的情况单独处理。处理方法与<span
lang=EN-US>EGA</span>非整屏移动情况完全一样。</p>

<p class=a><u><span lang=EN-US style='color:blue'>237</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/*
Not EGA/VGA */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>238</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>239</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__asm__(<i>&quot;cld\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>240</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>241</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movsl\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>242</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movl _video_num_columns,%%ecx\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>243</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>244</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;stosw&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>245</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::<i>&quot;a&quot;</i> (<u><span style='color:blue'>video_erase_char</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>246</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;c&quot;</i> ((<u><span style='color:blue'>bottom</span></u>-<u><span
style='color:blue'>top</span></u>-1)*<u><span style='color:blue'>video_num_columns</span></u>&gt;&gt;1),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>247</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;<i>&quot;D&quot;</i> (<u><span style='color:blue'>origin</span></u>+<u><span
style='color:blue'>video_size_row</span></u>*<u><span style='color:blue'>top</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>248</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;S&quot;</i> (<u><span style='color:blue'>origin</span></u>+<u><span
style='color:blue'>video_size_row</span></u>*(<u><span style='color:blue'>top</span></u>+1))</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>249</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;cx&quot;</i>,<i>&quot;di&quot;</i>,<i>&quot;si&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>250</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>251</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>252</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>向下卷动一行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>将屏幕滚动窗口向上移动一行，相应屏幕滚动区域内容向下移动<span
lang=EN-US>1</span>行。并在移动开始行的上</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>方出现一新行。参见程序列表后说明。处理方法与
<span lang=EN-US>scrup()</span>相似，只是为了在移动显示内存</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>数据时不会出现数据覆盖的问题，复制操作是以逆向进行的，即先从屏幕倒数第<span
lang=EN-US>2</span>行的最后</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>一个字符开始复制到最后一行，再将倒数第<span
lang=EN-US>3</span>行复制到倒数第<span lang=EN-US>2</span>行等等。因为此时对<span lang=EN-US>EGA/</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // VGA</span>显示类型和<span
lang=EN-US>MDA</span>类型的处理过程完全一样，所以该函数实际上没有必要写两段相同的代</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>码。即这里<span lang=EN-US>if</span>和<span
lang=EN-US>else</span>语句块中的操作完全一样！</p>

<p class=a><u><span lang=EN-US style='color:blue'>253</span></u><span
lang=EN-US> static void <u><span style='color:blue'>scrdown</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>254</span></u><span
lang=EN-US> {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>同样，滚屏区域必须起码有<span
lang=EN-US>2</span>行。如果滚屏区域顶行号大于等于区域底行号，则不满足进行滚</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>行操作的条件。另外，对于<span
lang=EN-US>EGA/VGA</span>卡，我们可以指定屏内行范围（区域）进行滚屏操作，而</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // MDA</span>单色显示卡只能进行整屏滚屏操作。由于窗口向上移动最多移动到当前控制台占用显示区</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>域内存的起始位置，因此不会发生屏幕窗口末端所对应的显示内存指针<span
lang=EN-US>scr_end</span>超出实际显示</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>内存末端的情况，所以这里只需要处理普通的内存数据移动情况。</p>

<p class=a><u><span lang=EN-US style='color:blue'>255</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>bottom</span></u> &lt;= <u><span style='color:blue'>top</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>256</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>257</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>video_type</span></u> == <u><span style='color:blue'>VIDEO_TYPE_EGAC</span></u>
|| <u><span style='color:blue'>video_type</span></u> == <u><span
style='color:blue'>VIDEO_TYPE_EGAM</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>258</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // %0 - eax(</span>擦除字符<span
lang=EN-US>+</span>属性<span lang=EN-US>)</span>；<span lang=EN-US>%1 - ecx(top</span>行到<span
lang=EN-US> bottom-1 </span>行的行数所对应的内存长字数<span lang=EN-US>)</span>；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // %2 - edi(</span>窗口右下角最后一个长字位置<span
lang=EN-US>)</span>；<span lang=EN-US>%3 - esi(</span>窗口倒数第<span lang=EN-US>2</span>行最后一个长字位置<span
lang=EN-US>)</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>移动方向：<span lang=EN-US>[esi]</span><span
lang=EN-US style='font-family:Wingdings'>è</span><span lang=EN-US>[edi]</span>，移动<span
lang=EN-US>ecx</span>个长字。</p>

<p class=a><u><span lang=EN-US style='color:blue'>259</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__asm__(<i>&quot;std\n\t&quot;</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>置方向位！！</p>

<p class=a><u><span lang=EN-US style='color:blue'>260</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>重复操作，向下移动从<span lang=EN-US>top</span>行到</p>

<p class=a><u><span lang=EN-US style='color:blue'>261</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movsl\n\t&quot;</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// bottom-1</span>行对应的内存数据。</p>

<p class=a><u><span lang=EN-US style='color:blue'>262</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;addl $2,%%edi\n\t&quot;</i>&nbsp; <b><i>/* %edi has been decremented
by 4 */</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* %edi</span>已减<span lang=EN-US>4</span>，因也是反向填擦除字符<span lang=EN-US>*/</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>263</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movl _video_num_columns,%%ecx\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>264</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>将擦除字符填入上方新行中。</p>

<p class=a><u><span lang=EN-US style='color:blue'>265</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;stosw&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>266</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::<i>&quot;a&quot;</i> (<u><span style='color:blue'>video_erase_char</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>267</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;c&quot;</i> ((<u><span style='color:blue'>bottom</span></u>-<u><span
style='color:blue'>top</span></u>-1)*<u><span style='color:blue'>video_num_columns</span></u>&gt;&gt;1),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>268</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;D&quot;</i> (<u><span style='color:blue'>origin</span></u>+<u><span
style='color:blue'>video_size_row</span></u>*<u><span style='color:blue'>bottom</span></u>-4),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>269</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;S&quot;</i> (<u><span style='color:blue'>origin</span></u>+<u><span
style='color:blue'>video_size_row</span></u>*(<u><span style='color:blue'>bottom</span></u>-1)-4)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>270</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;ax&quot;</i>,<i>&quot;cx&quot;</i>,<i>&quot;di&quot;</i>,<i>&quot;si&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>271</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果不是<span lang=EN-US>EGA</span>显示类型，则执行以下操作（与上面完全一样）。</p>

<p class=a><u><span lang=EN-US style='color:blue'>272</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/*
Not EGA/VGA */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>273</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>274</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__asm__(<i>&quot;std\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>275</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>276</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movsl\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>277</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;addl $2,%%edi\n\t&quot;</i>&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/* %edi has
been decremented by 4 */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>278</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movl _video_num_columns,%%ecx\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>279</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>280</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;stosw&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>281</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::<i>&quot;a&quot;</i> (<u><span style='color:blue'>video_erase_char</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>282</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;c&quot;</i> ((<u><span style='color:blue'>bottom</span></u>-<u><span
style='color:blue'>top</span></u>-1)*<u><span style='color:blue'>video_num_columns</span></u>&gt;&gt;1),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>283</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;D&quot;</i> (<u><span style='color:blue'>origin</span></u>+<u><span
style='color:blue'>video_size_row</span></u>*<u><span style='color:blue'>bottom</span></u>-4),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>284</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;S&quot;</i> (<u><span style='color:blue'>origin</span></u>+<u><span
style='color:blue'>video_size_row</span></u>*(<u><span style='color:blue'>bottom</span></u>-1)-4)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>285</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;ax&quot;</i>,<i>&quot;cx&quot;</i>,<i>&quot;di&quot;</i>,<i>&quot;si&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>286</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>287</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>288</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>光标在同列位置下移一行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果光标没有处在最后一行上，则直接修改光标当前行变量<span
lang=EN-US>y++</span>，并调整光标对应显示内存</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>位置<span lang=EN-US>pos</span>（加上一行字符所对应的内存长度）。否则就需要将屏幕窗口内容上移一行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>函数名称<span lang=EN-US>lf</span>（<span
lang=EN-US>line feed </span>换行）是指处理控制字符<span lang=EN-US>LF</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>289</span></u><span
lang=EN-US> static void <u><span style='color:blue'>lf</span></u>(int currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>290</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>291</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>y</span></u>+1&lt;<u><span style='color:blue'>bottom</span></u>)
{</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>292</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>y</span></u>++;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>293</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> += <u><span style='color:blue'>video_size_row</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>加上屏幕一行占用内存的字节数。</p>

<p class=a><u><span lang=EN-US style='color:blue'>294</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>295</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>296</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>scrup</span></u>(currcons);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;// </span>将屏幕窗口内容上移一行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>297</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>298</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>光标在同列上移一行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果光标不在屏幕第一行上，则直接修改光标当前行标量<span
lang=EN-US>y--</span>，并调整光标对应显示内存位置</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // pos</span>，减去屏幕上一行字符所对应的内存长度字节数。否则需要将屏幕窗口内容下移一行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>函数名称<span lang=EN-US>ri</span>（<span
lang=EN-US>reverse index </span>反向索引）是指控制字符<span lang=EN-US>RI</span>或转义序列“<span
lang=EN-US>ESC M</span>”。</p>

<p class=a><u><span lang=EN-US style='color:blue'>299</span></u><span
lang=EN-US> static void <u><span style='color:blue'>ri</span></u>(int currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>300</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>301</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>y</span></u>&gt;<u><span style='color:blue'>top</span></u>)
{</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>302</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>y</span></u>--;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>303</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> -= <u><span style='color:blue'>video_size_row</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>减去屏幕一行占用内存的字节数。</p>

<p class=a><u><span lang=EN-US style='color:blue'>304</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>305</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>306</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>scrdown</span></u>(currcons);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>将屏幕窗口内容下移一行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>307</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>308</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>光标回到第<span lang=EN-US>1</span>列（<span
lang=EN-US>0</span>列）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>调整光标对应内存位置<span
lang=EN-US>pos</span>。光标所在列号<span lang=EN-US>*2 </span>即是<span lang=EN-US>0</span>列到光标所在列对应的内存字节长度。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>函数名称<span lang=EN-US>cr</span>（<span
lang=EN-US>carriage return </span>回车）指明处理的控制字符是回车字符。</p>

<p class=a><u><span lang=EN-US style='color:blue'>309</span></u><span
lang=EN-US> static void <u><span style='color:blue'>cr</span></u>(int currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>310</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>311</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>pos</span></u> -= <u><span style='color:blue'>x</span></u>&lt;&lt;1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>减去<span lang=EN-US>0</span>列到光标处占用的内存字节数。</p>

<p class=a><u><span lang=EN-US style='color:blue'>312</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>x</span></u>=0;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>313</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>314</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>擦除光标前一字符（用空格替代）（<span
lang=EN-US>del - delete </span>删除）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果光标没有处在<span
lang=EN-US>0</span>列，则将光标对应内存位置<span lang=EN-US>pos</span>后退<span lang=EN-US>2</span>字节（对应屏幕上一个字符），</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后将当前光标变量列值减<span
lang=EN-US>1</span>，并将光标所在位置处字符擦除。</p>

<p class=a><u><span lang=EN-US style='color:blue'>315</span></u><span
lang=EN-US> static void <u><span style='color:blue'>del</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>316</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>317</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>x</span></u>) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>318</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> -= 2;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>319</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>x</span></u>--;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>320</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*(unsigned short *)<u><span style='color:blue'>pos</span></u> = <u><span
style='color:blue'>video_erase_char</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>321</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>322</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>323</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>删除屏幕上与光标位置相关的部分。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ANSI</span>控制序列：<span
lang=EN-US>'ESC [ Ps J'</span>（<span lang=EN-US>Ps =0 -</span>删除光标处到屏幕底端；<span
lang=EN-US>1 -</span>删除屏幕开始到光标处；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // 2 - </span>整屏删除）。本函数根据指定的控制序列具体参数值，执行与光标位置相关的删除操作，</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>并且在擦除字符或行时光标位置不变。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>函数名称<span lang=EN-US>csi_J
</span>（<span lang=EN-US>CSI - Control Sequence Introducer</span>，即控制序列引导码）指明对控制</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>序列“<span lang=EN-US>CSI
Ps J</span>”进行处理。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数：<span lang=EN-US>vpar
- </span>对应上面控制序列中<span lang=EN-US>Ps</span>的值。</p>

<p class=a><u><span lang=EN-US style='color:blue'>324</span></u><span
lang=EN-US> static void <u><span style='color:blue'>csi_J</span></u>(int
currcons, int vpar)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>325</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>326</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long <u><span
style='color:blue'>count</span></u> __asm__(<i>&quot;cx&quot;</i>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设为寄存器变量。</p>

<p class=a><u><span lang=EN-US style='color:blue'>327</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long start __asm__(<i>&quot;di&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>328</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>首先根据三种情况分别设置需要删除的字符数和删除开始的显示内存位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>329</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch (vpar) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>330</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 0: <b><i>/* erase from cursor to end of display */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>331</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>count</span></u> = (<u><span style='color:blue'>scr_end</span></u>-<u><span
style='color:blue'>pos</span></u>)&gt;&gt;1;&nbsp;&nbsp; /* </span>擦除光标到屏幕底端所有字符<span
lang=EN-US> */</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>332</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
start = <u><span style='color:blue'>pos</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>333</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>334</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 1: <b><i>/* erase from start to cursor */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>335</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>count</span></u> = (<u><span style='color:blue'>pos</span></u>-<u><span
style='color:blue'>origin</span></u>)&gt;&gt;1;&nbsp; /* </span>删除从屏幕开始到光标处的字符<span
lang=EN-US> */</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>336</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
start = <u><span style='color:blue'>origin</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>337</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>338</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 2: <b><i>/* erase whole display */</i></b> &nbsp;&nbsp;&nbsp;&nbsp;/* </span>删除整个屏幕上的所有字符<span
lang=EN-US> */</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>339</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>count</span></u> = <u><span style='color:blue'>video_num_columns</span></u>
* <u><span style='color:blue'>video_num_lines</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>340</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
start = <u><span style='color:blue'>origin</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>341</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>342</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
default:</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>343</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>344</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后使用擦除字符填写被删除字符的地方。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // %0 -ecx(</span>删除的字符数<span
lang=EN-US>count)</span>；<span lang=EN-US>%1 -edi(</span>删除操作开始地址<span
lang=EN-US>)</span>；<span lang=EN-US>%2 -eax</span>（填入的擦除字符）。</p>

<p class=a><u><span lang=EN-US style='color:blue'>345</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; __asm__(<i>&quot;cld\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>346</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>347</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;stosw\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>348</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::<i>&quot;c&quot;</i> (<u><span style='color:blue'>count</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>349</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;D&quot;</i> (start),<i>&quot;a&quot;</i> (<u><span style='color:blue'>video_erase_char</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>350</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;cx&quot;</i>,<i>&quot;di&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>351</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>352</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>删除一行上与光标位置相关的部分。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ANSI</span>转义字符序列：<span
lang=EN-US>'ESC [ Ps K'</span>（<span lang=EN-US>Ps = 0 </span>删除到行尾；<span
lang=EN-US>1 </span>从开始删除；<span lang=EN-US>2 </span>整行都删除）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>本函数根据参数擦除光标所在行的部分或所有字符。擦除操作从屏幕上移走字符但不影响其</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>他字符。擦除的字符被丢弃。在擦除字符或行时光标位置不变。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数：<span lang=EN-US>par
- </span>对应上面控制序列中<span lang=EN-US>Ps</span>的值。</p>

<p class=a><u><span lang=EN-US style='color:blue'>353</span></u><span
lang=EN-US> static void <u><span style='color:blue'>csi_K</span></u>(int
currcons, int vpar)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>354</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>355</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long <u><span
style='color:blue'>count</span></u> __asm__(<i>&quot;cx&quot;</i>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置寄存器变量。</p>

<p class=a><u><span lang=EN-US style='color:blue'>356</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long start __asm__(<i>&quot;di&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>357</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>首先根据三种情况分别设置需要删除的字符数和删除开始的显示内存位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>358</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch (vpar) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>359</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 0: <b><i>/* erase from cursor to end of line */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>360</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>x</span></u>&gt;=<u><span style='color:blue'>video_num_columns</span></u>)&nbsp;&nbsp;&nbsp;&nbsp;
/* </span>删除光标到行尾所有字符<span lang=EN-US> */</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>361</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>362</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>count</span></u> = <u><span style='color:blue'>video_num_columns</span></u>-<u><span
style='color:blue'>x</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>363</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
start = <u><span style='color:blue'>pos</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>364</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>365</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 1: <b><i>/* erase from start of line to cursor */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>366</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
start = <u><span style='color:blue'>pos</span></u> - (<u><span
style='color:blue'>x</span></u>&lt;&lt;1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* </span>删除从行开始到光标处<span lang=EN-US> */</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>367</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>count</span></u> = (<u><span style='color:blue'>x</span></u>&lt;<u><span
style='color:blue'>video_num_columns</span></u>)?<u><span style='color:blue'>x</span></u>:<u><span
style='color:blue'>video_num_columns</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>368</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>369</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 2: <b><i>/* erase whole line */</i></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* </span>将整行字符全删除<span lang=EN-US> */</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>370</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
start = <u><span style='color:blue'>pos</span></u> - (<u><span
style='color:blue'>x</span></u>&lt;&lt;1);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>371</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>count</span></u> = <u><span style='color:blue'>video_num_columns</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>372</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>373</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
default:</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>374</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>375</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后使用擦除字符填写删除字符的地方。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // %0 - ecx(</span>删除字符数<span
lang=EN-US>count)</span>；<span lang=EN-US>%1 -edi(</span>删除操作开始地址<span
lang=EN-US>)</span>；<span lang=EN-US>%2 -eax</span>（填入的擦除字符）。</p>

<p class=a><u><span lang=EN-US style='color:blue'>376</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; __asm__(<i>&quot;cld\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>377</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;rep\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>378</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;stosw\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>379</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::<i>&quot;c&quot;</i> (<u><span style='color:blue'>count</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>380</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;D&quot;</i> (start),<i>&quot;a&quot;</i> (<u><span style='color:blue'>video_erase_char</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>381</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;cx&quot;</i>,<i>&quot;di&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>382</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>383</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>设置显示字符属性。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ANSI</span>转义序列：<span
lang=EN-US>'ESC [ Ps;Ps m'</span>。<span lang=EN-US>Ps = 0 - </span>默认属性；<span
lang=EN-US>1 - </span>粗体并增亮；<span lang=EN-US>4 - </span>下划线；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // 5 - </span>闪烁；<span
lang=EN-US>7 - </span>反显；<span lang=EN-US>22 - </span>非粗体；<span lang=EN-US>24 -
</span>无下划线；<span lang=EN-US>25 - </span>无闪烁；<span lang=EN-US>27 - </span>正显；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // 30--38 - </span>设置前景色彩；<span
lang=EN-US>39 - </span>默认前景色（<span lang=EN-US>White</span>）；<span lang=EN-US>40--48
- </span>设置背景色彩；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // 49 - </span>默认背景色（<span
lang=EN-US>Black</span>）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>该控制序列根据参数设置字符显示属性。以后所有发送到终端的字符都将使用这里指定的属</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>性，直到再次执行本控制序列重新设置字符显示的属性。</p>

<p class=a><u><span lang=EN-US style='color:blue'>384</span></u><span
lang=EN-US> void <u><span style='color:blue'>csi_m</span></u>(int currcons )</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>385</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>386</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>387</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>一个控制序列中可以带有多个不同参数。参数存储在数组<span
lang=EN-US>par[]</span>中。下面就根据接收到的参数</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>个数<span lang=EN-US>npar</span>，循环处理各个参数<span
lang=EN-US>Ps</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps =
0</span>，则把当前虚拟控制台随后显示的字符属性设置为默认属性<span lang=EN-US>def_attr</span>。初始化时</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // def_attr</span>已被设置成<span
lang=EN-US>0x07</span>（黑底白字）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps
= 1</span>，则把当前虚拟控制台随后显示的字符属性设置为粗体或增亮显示。 如果是彩色</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>显示，则把字符属性或上<span
lang=EN-US>0x08</span>让字符高亮度显示；如果是单色显示，则让字符带下划线显示。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps
= 4</span>，则对彩色和单色显示进行不同的处理。若此时不是彩色显示方式，则让字符带</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>下划线显示。如果是彩色显示，那么若原来<span
lang=EN-US>vc_bold_attr</span>不等于<span lang=EN-US>-1</span>时就复位其背景色；否则</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>的话就把前景色取反。若取反后前景色与背景色相同，就把前景色增<span
lang=EN-US>1</span>而取另一种颜色。</p>

<p class=a><u><span lang=EN-US style='color:blue'>388</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (i=0;i&lt;=<u><span
style='color:blue'>npar</span></u>;i++)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>389</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
switch (<u><span style='color:blue'>par</span></u>[i]) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>390</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 0: <u><span style='color:blue'>attr</span></u>=<u><span style='color:blue'>def_attr</span></u>;break;&nbsp;
<b><i>/* default */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>391</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case
1: <u><span style='color:blue'>attr</span></u>=(<u><span style='color:blue'>iscolor</span></u>?<u><span
style='color:blue'>attr</span></u>|0x08:<u><span style='color:blue'>attr</span></u>|0x0f);break;&nbsp; <b><i>/* bold */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>392</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/*case 4: attr=attr|0x01;break;*/</i></b>&nbsp; <b><i>/* underline */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>393</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 4: <b><i>/* bold */</i></b> </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>394</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>iscolor</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>395</span></u><span
lang=EN-US>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>attr</span></u> |= 0x01;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>单色则带下划线显示。</p>

<p class=a><u><span lang=EN-US style='color:blue'>396</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>397</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{ <b><i>/* check if forground == background */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>398</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_bold_attr !=
-1)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>399</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>attr</span></u> = (<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_bold_attr&amp;0x0f)|(0xf0&amp;(<u><span
style='color:blue'>attr</span></u>));</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>400</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>401</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{ short newattr = (<u><span style='color:blue'>attr</span></u>&amp;0xf0)|(0xf&amp;(~<u><span
style='color:blue'>attr</span></u>));</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>402</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>attr</span></u> = ((newattr&amp;0xf)==((<u><span
style='color:blue'>attr</span></u>&gt;&gt;4)&amp;0xf)? </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>403</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>attr</span></u>&amp;0xf0)|(((<u><span
style='color:blue'>attr</span></u>&amp;0xf)+1)%0xf):</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>404</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
newattr);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>405</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp;&nbsp;&nbsp; </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>406</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>407</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps
= 5</span>，则把当前虚拟控制台随后显示的字符设置为闪烁，即把属性字节比特位<span lang=EN-US>7</span>置<span
lang=EN-US>1</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps
= 7</span>，则把当前虚拟控制台随后显示的字符设置为反显，即把前景和背景色交换。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps
= 22</span>，则取消随后字符的高亮度显示（取消粗体显示）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps
= 24</span>，则对于单色显示是取消随后字符的下划线显示，对于彩色显示则是取消绿色。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps
= 25</span>，则取消随后字符的闪烁显示。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps
= 27</span>，则取消随后字符的反显。</p>

<p class=a><span lang=EN-US>&nbsp; &nbsp;&nbsp;// </span>如果<span lang=EN-US>Ps
= 39</span>，则复位随后字符的前景色为默认前景色（白色）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>Ps
= 49</span>，则复位随后字符的背景色为默认背景色（黑色）。</p>

<p class=a><u><span lang=EN-US style='color:blue'>408</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 5: <u><span style='color:blue'>attr</span></u>=<u><span style='color:blue'>attr</span></u>|0x80;break;&nbsp;
<b><i>/* blinking */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>409</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 7: <u><span style='color:blue'>attr</span></u>=(<u><span style='color:
blue'>attr</span></u>&lt;&lt;4)|(<u><span style='color:blue'>attr</span></u>&gt;&gt;4);break;&nbsp;
<b><i>/* negative */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>410</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 22: <u><span
style='color:blue'>attr</span></u>=<u><span style='color:blue'>attr</span></u>&amp;0xf7;break;
<b><i>/* not bold */</i></b> </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>411</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 24: <u><span style='color:blue'>attr</span></u>=<u><span style='color:
blue'>attr</span></u>&amp;0xfe;break;&nbsp; <b><i>/* not underline */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>412</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 25: <u><span style='color:blue'>attr</span></u>=<u><span style='color:
blue'>attr</span></u>&amp;0x7f;break;&nbsp; <b><i>/* not blinking */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>413</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 27: <u><span style='color:blue'>attr</span></u>=<u><span style='color:
blue'>def_attr</span></u>;break; <b><i>/* positive image */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>414</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 39: <u><span style='color:blue'>attr</span></u>=(<u><span
style='color:blue'>attr</span></u> &amp; 0xf0)|(<u><span style='color:blue'>def_attr</span></u>
&amp; 0x0f); break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>415</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case 49: <u><span style='color:blue'>attr</span></u>=(<u><span
style='color:blue'>attr</span></u> &amp; 0x0f)|(<u><span
style='color:blue'>def_attr</span></u> &amp; 0xf0); break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>当<span lang=EN-US>Ps</span>（<span
lang=EN-US>par[i]</span>）为其他值时，则是设置指定的前景色或背景色。如果<span lang=EN-US>Ps = 30..37</span>，则是设置</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>前景色；如果<span
lang=EN-US>Ps=40..47</span>，则是设置背景色。有关颜色值请参见程序后说明。</p>

<p class=a><u><span lang=EN-US style='color:blue'>416</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
default:</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>417</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>can_do_colour</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>418</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>419</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>iscolor</span></u> = 1;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>420</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if ((<u><span style='color:blue'>par</span></u>[i]&gt;=30) &amp;&amp; (<u><span
style='color:blue'>par</span></u>[i]&lt;=38))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置前景色。</p>

<p class=a><u><span lang=EN-US style='color:blue'>421</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>attr</span></u> = (<u><span style='color:blue'>attr</span></u>
&amp; 0xf0) | (<u><span style='color:blue'>par</span></u>[i]-30);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>422</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else&nbsp; <b><i>/* Background color */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>423</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if ((<u><span style='color:blue'>par</span></u>[i]&gt;=40) &amp;&amp; (<u><span
style='color:blue'>par</span></u>[i]&lt;=48))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </span>设置背景色。</p>

<p class=a><u><span lang=EN-US style='color:blue'>424</span></u><span
lang=EN-US>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>attr</span></u> = (<u><span style='color:blue'>attr</span></u>
&amp; 0x0f) | ((<u><span
style='color:blue'>par</span></u>[i]-40)&lt;&lt;4);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>425</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>426</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>427</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>428</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>429</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>设置显示光标。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>根据光标对应显示内存位置<span
lang=EN-US>pos</span>，设置显示控制器光标的显示位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>430</span></u><span
lang=EN-US> static inline void <u><span style='color:blue'>set_cursor</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>431</span></u><span
lang=EN-US> {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>既然我们需要设置显示光标，说明有键盘操作，因此需要恢复进行黑屏操作的延时计数值。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>另外，显示光标的控制台必须是前台控制台，因此若当前处理的台号<span
lang=EN-US>currcons</span>不是前台控</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>制台就立刻返回。</p>

<p class=a><u><span lang=EN-US style='color:blue'>432</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>blankcount</span></u> = <u><span style='color:blue'>blankinterval</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>复位黑屏操作的计数值。</p>

<p class=a><u><span lang=EN-US style='color:blue'>433</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (currcons != <u><span
style='color:blue'>fg_console</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>434</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后使用索引寄存器端口选择显示控制数据寄存器<span
lang=EN-US>r14</span>（光标当前显示位置高字节），接着</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>写入光标当前位置高字节（向右移动<span
lang=EN-US>9</span>位表示高字节移到低字节再除以<span lang=EN-US>2</span>）。是相对于默认</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>显示内存操作的。再使用索引寄存器选择<span
lang=EN-US>r15</span>，并将光标当前位置低字节写入其中。</p>

<p class=a><u><span lang=EN-US style='color:blue'>435</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>cli</span></u>();</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>436</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(14, <u><span style='color:blue'>video_port_reg</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>437</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<u><span
style='color:blue'>outb_p</span></u>(0xff&amp;((<u><span style='color:blue'>pos</span></u>-<u><span
style='color:blue'>video_mem_base</span></u>)&gt;&gt;9), <u><span
style='color:blue'>video_port_val</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>438</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(15, <u><span style='color:blue'>video_port_reg</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>439</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(0xff&amp;((<u><span style='color:blue'>pos</span></u>-<u><span
style='color:blue'>video_mem_base</span></u>)&gt;&gt;1), <u><span
style='color:blue'>video_port_val</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>440</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>sti</span></u>();</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>441</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>442</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>隐藏光标。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>把光标设置到当前虚拟控制台窗口的末端，起到隐藏光标的作用。</p>

<p class=a><u><span lang=EN-US style='color:blue'>443</span></u><span
lang=EN-US> static inline void <u><span style='color:blue'>hide_cursor</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>444</span></u><span
lang=EN-US> {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>首先使用索引寄存器端口选择显示控制数据寄存器<span
lang=EN-US>r14</span>（光标当前显示位置高字节），然后</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>写入光标当前位置高字节（向右移动<span
lang=EN-US>9</span>位表示高字节移到低字节再除以<span lang=EN-US>2</span>）。是相对于默认</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>显示内存操作的。再使用索引寄存器选择<span
lang=EN-US>r15</span>，并将光标当前位置低字节写入其中。</p>

<p class=a><u><span lang=EN-US style='color:blue'>445</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(14, <u><span style='color:blue'>video_port_reg</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>446</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(0xff&amp;((<u><span style='color:blue'>scr_end</span></u>-<u><span
style='color:blue'>video_mem_base</span></u>)&gt;&gt;9), <u><span
style='color:blue'>video_port_val</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>447</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(15, <u><span style='color:blue'>video_port_reg</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>448</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(0xff&amp;((<u><span style='color:blue'>scr_end</span></u>-<u><span
style='color:blue'>video_mem_base</span></u>)&gt;&gt;1), <u><span
style='color:blue'>video_port_val</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>449</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>450</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>发送对<span lang=EN-US>VT100</span>的响应序列。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>即为响应主机请求终端向主机发送设备属性（<span
lang=EN-US>DA</span>）。主机通过发送不带参数或参数是<span lang=EN-US>0</span>的<span lang=EN-US>DA</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>控制序列（<span lang=EN-US>'ESC
[ 0c' </span>或 <span
lang=EN-US>'ESC Z'</span>）要求终端发送一个设备属性（<span lang=EN-US>DA</span>）控制序列，终端则发</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>送<span lang=EN-US>85</span>行上定义的应答序列（即
<span lang=EN-US>'ESC [?1;2c'</span>）来响应主机的序列，该序列告诉主机本终端</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>是具有高级视频功能的<span
lang=EN-US>VT100</span>兼容终端。处理过程是将应答序列放入读缓冲队列中，并使用</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // copy_to_cooked()</span>函数处理后放入辅助队列中。</p>

<p class=a><u><span lang=EN-US style='color:blue'>451</span></u><span
lang=EN-US> static void <u><span style='color:blue'>respond</span></u>(int
currcons, struct <u><span style='color:blue'>tty_struct</span></u> * tty)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>452</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>453</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char * p = <u><span
style='color:blue'>RESPONSE</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>定义在第<span lang=EN-US>147</span>行上。</p>

<p class=a><u><span lang=EN-US style='color:blue'>454</span></u><span
lang=EN-US> </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>455</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>cli</span></u>();</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>456</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (*p) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>将应答序列放入读队列。</p>

<p class=a><u><span lang=EN-US style='color:blue'>457</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>PUTCH</span></u>(*p,tty-&gt;read_q);&nbsp;&nbsp;&nbsp;
// </span>逐字符放入。<span lang=EN-US>include/linux/tty.h</span>，<span lang=EN-US>46</span>行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>458</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;p++;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>459</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>460</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>sti</span></u>();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>转换成规范模式（放入辅助队列中）。</p>

<p class=a><u><span lang=EN-US style='color:blue'>461</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>copy_to_cooked</span></u>(tty);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// tty_io.c</span>，<span lang=EN-US>120</span>行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>462</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>463</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>在光标处插入一空格字符。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>把光标开始处的所有字符右移一格，并将擦除字符插入在光标所在处。</p>

<p class=a><u><span lang=EN-US style='color:blue'>464</span></u><span
lang=EN-US> static void <u><span style='color:blue'>insert_char</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>465</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>466</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i=<u><span
style='color:blue'>x</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>467</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned short tmp,
old = <u><span style='color:blue'>video_erase_char</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>擦除字符（加属性）。</p>

<p class=a><u><span lang=EN-US style='color:blue'>468</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned short * p
= (unsigned short *) <u><span style='color:blue'>pos</span></u>;&nbsp;&nbsp;&nbsp;
// </span>光标对应内存位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>469</span></u><span
lang=EN-US> </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>470</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (i++&lt;<u><span
style='color:blue'>video_num_columns</span></u>) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>471</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
tmp=*p;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>472</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*p=old;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>473</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
old=tmp;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>474</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
p++;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>475</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>476</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>477</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>在光标处插入一行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>将屏幕窗口从光标所在行到窗口底的内容向下卷动一行。光标将处在新的空行上。</p>

<p class=a><u><span lang=EN-US style='color:blue'>478</span></u><span
lang=EN-US> static void <u><span style='color:blue'>insert_line</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>479</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>480</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int
oldtop,oldbottom;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>481</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>首先保存屏幕窗口卷动开始行<span
lang=EN-US>top</span>和最后行<span lang=EN-US>bottom</span>值，然后从光标所在行让屏幕内容向下</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>滚动一行。最后恢复屏幕窗口卷动开始行<span
lang=EN-US>top</span>和最后行<span lang=EN-US>bottom</span>的原来值。</p>

<p class=a><u><span lang=EN-US style='color:blue'>482</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oldtop=<u><span
style='color:blue'>top</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>483</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oldbottom=<u><span
style='color:blue'>bottom</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>484</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>top</span></u>=<u><span style='color:blue'>y</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置屏幕卷动开始行和结束行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>485</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>bottom</span></u> = <u><span style='color:blue'>video_num_lines</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>486</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>scrdown</span></u>(currcons);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>从光标开始处，屏幕内容向下滚动一行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>487</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>top</span></u>=oldtop;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>488</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>bottom</span></u>=oldbottom;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>489</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>490</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>删除一个字符。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>删除光标处的一个字符，光标右边的所有字符左移一格。</p>

<p class=a><u><span lang=EN-US style='color:blue'>491</span></u><span
lang=EN-US> static void <u><span style='color:blue'>delete_char</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>492</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>493</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>494</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned short * p
= (unsigned short *) <u><span style='color:blue'>pos</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>495</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果光标的当前列位置<span
lang=EN-US>x</span>超出屏幕最右列，则返回。否则从光标右一个字符开始到行末所有</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>字符左移一格。然后在最后一个字符处填入擦除字符。</p>

<p class=a><u><span lang=EN-US style='color:blue'>496</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>x</span></u>&gt;=<u><span style='color:blue'>video_num_columns</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>497</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>498</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = <u><span
style='color:blue'>x</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>499</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;while (++i &lt; <u><span
style='color:blue'>video_num_columns</span></u>) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>光标右所有字符左移<span lang=EN-US>1</span>格。</p>

<p class=a><u><span lang=EN-US style='color:blue'>500</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*p = *(p+1);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>501</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
p++;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>502</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>503</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *p = <u><span
style='color:blue'>video_erase_char</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>最后填入擦除字符。</p>

<p class=a><u><span lang=EN-US style='color:blue'>504</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>505</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>删除光标所在行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>删除光标所在的一行，并从光标所在行开始屏幕内容上卷一行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>506</span></u><span
lang=EN-US> static void <u><span style='color:blue'>delete_line</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>507</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>508</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int
oldtop,oldbottom;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>509</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>首先保存屏幕卷动开始行<span
lang=EN-US>top</span>和最后行<span lang=EN-US>bottom</span>值，然后从光标所在行让屏幕内容向上滚动</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>一行。最后恢复屏幕卷动开始行<span
lang=EN-US>top</span>和最后行<span lang=EN-US>bottom</span>的原来值。</p>

<p class=a><u><span lang=EN-US style='color:blue'>510</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oldtop=<u><span
style='color:blue'>top</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>511</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oldbottom=<u><span
style='color:blue'>bottom</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>512</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>top</span></u>=<u><span style='color:blue'>y</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置屏幕卷动开始行和最后行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>513</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>bottom</span></u> = <u><span style='color:blue'>video_num_lines</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>514</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>scrup</span></u>(currcons);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>从光标开始处，屏幕内容向上滚动一行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>515</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>top</span></u>=oldtop;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>516</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>bottom</span></u>=oldbottom;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>517</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>518</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>在光标处插入<span
lang=EN-US>nr</span>个字符。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ANSI</span>转义字符序列：<span
lang=EN-US>'ESC [ Pn @'</span>。在当前光标处插入<span lang=EN-US>1</span>个或多个空格字符。<span
lang=EN-US>Pn</span>是插入的字</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>符数。默认是<span
lang=EN-US>1</span>。光标将仍然处于第<span lang=EN-US>1</span>个插入的空格字符处。在光标与右边界的字符将右移。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>超过右边界的字符将被丢失。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数 <span lang=EN-US>nr
= </span>转义字符序列中的参数<span lang=EN-US>Pn</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>519</span></u><span
lang=EN-US> static void <u><span style='color:blue'>csi_at</span></u>(int
currcons, unsigned int nr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>520</span></u><span
lang=EN-US> {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果插入的字符数大于一行字符数，则截为一行字符数；若插入字符数<span
lang=EN-US>nr</span>为<span lang=EN-US>0</span>，则插入<span lang=EN-US>1</span>个</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>字符。然后循环插入指定个空格字符。</p>

<p class=a><u><span lang=EN-US style='color:blue'>521</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nr &gt; <u><span
style='color:blue'>video_num_columns</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>522</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nr = <u><span style='color:blue'>video_num_columns</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>523</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (!nr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>524</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nr = 1;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>525</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (nr--)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>526</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>insert_char</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>527</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>528</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>在光标位置处插入<span
lang=EN-US>nr</span>行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ANSI</span>转义字符序列：<span
lang=EN-US>'ESC [ Pn L'</span>。该控制序列在光标处插入<span lang=EN-US>1</span>行或多行空行。操作完成后</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>光标位置不变。当空行被插入时，光标以下滚动区域内的行向下移动。滚动出显示页的行就</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>丢失。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数 <span lang=EN-US>nr
= </span>转义字符序列中的参数<span lang=EN-US>Pn</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>529</span></u><span
lang=EN-US> static void <u><span style='color:blue'>csi_L</span></u>(int
currcons, unsigned int nr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>530</span></u><span
lang=EN-US> {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果插入的行数大于屏幕最多行数，则截为屏幕显示行数；若插入行数<span
lang=EN-US>nr</span>为<span lang=EN-US>0</span>，则插入<span lang=EN-US>1</span>行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后循环插入指定行数<span
lang=EN-US>nr</span>的空行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>531</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nr &gt; <u><span
style='color:blue'>video_num_lines</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>532</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nr = <u><span style='color:blue'>video_num_lines</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>533</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (!nr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>534</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nr = 1;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>535</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (nr--)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>536</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>insert_line</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>537</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>538</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>删除光标处的<span
lang=EN-US>nr</span>个字符。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ANSI</span>转义序列：<span
lang=EN-US>'ESC [ Pn P'</span>。该控制序列从光标处删除<span lang=EN-US>Pn</span>个字符。当一个字符被删除时，</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>光标右所有字符都左移。这会在右边界处产生一个空字符。其属性应该与最后一个左移字符</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>相同，但这里作了简化处理，仅使用字符的默认属性（黑底白字空格<span
lang=EN-US>0x0720</span>）来设置空字符。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数 <span lang=EN-US>nr
= </span>转义字符序列中的参数<span lang=EN-US>Pn</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>539</span></u><span
lang=EN-US> static void <u><span style='color:blue'>csi_P</span></u>(int
currcons, unsigned int nr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>540</span></u><span
lang=EN-US> {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果删除的字符数大于一行字符数，则截为一行字符数；若删除字符数<span
lang=EN-US>nr</span>为<span lang=EN-US>0</span>，则删除<span lang=EN-US>1</span>个</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>字符。然后循环删除光标处指定字符数<span
lang=EN-US>nr</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>541</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nr &gt; <u><span
style='color:blue'>video_num_columns</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>542</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nr = <u><span style='color:blue'>video_num_columns</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>543</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (!nr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>544</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nr = 1;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>545</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (nr--)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>546</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>delete_char</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>547</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>548</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>删除光标处的<span
lang=EN-US>nr</span>行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ANSI</span>转义序列：<span
lang=EN-US>'ESC [ Pn M'</span>。该控制序列在滚动区域内，从光标所在行开始删除<span lang=EN-US>1</span>行或多</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>行。当行被删除时，滚动区域内的被删行以下的行会向上移动，并且会在最底行添加<span
lang=EN-US>1</span>空行。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>若<span lang=EN-US>Pn</span>大于显示页上剩余行数，则本序列仅删除这些剩余行，并对滚动区域外不起作用。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数 <span lang=EN-US>nr
= </span>转义字符序列中的参数<span lang=EN-US>Pn</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>549</span></u><span
lang=EN-US> static void <u><span style='color:blue'>csi_M</span></u>(int
currcons, unsigned int nr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>550</span></u><span
lang=EN-US> {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果删除的行数大于屏幕最多行数，则截为屏幕显示行数；若欲删除的行数<span
lang=EN-US>nr</span>为<span lang=EN-US>0</span>，则删除</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // 1</span>行。然后循环删除指定行数<span
lang=EN-US>nr</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>551</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nr &gt; <u><span
style='color:blue'>video_num_lines</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>552</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nr = <u><span style='color:blue'>video_num_lines</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>553</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (!nr)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>554</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nr=1;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>555</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (nr--)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>556</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>delete_line</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>557</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>558</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>保存当前光标位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>559</span></u><span
lang=EN-US> static void <u><span style='color:blue'>save_cur</span></u>(int
currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>560</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>561</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>saved_x</span></u>=<u><span style='color:blue'>x</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>562</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>saved_y</span></u>=<u><span style='color:blue'>y</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>563</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>564</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>恢复保存的光标位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>565</span></u><span
lang=EN-US> static void <u><span style='color:blue'>restore_cur</span></u>(int currcons)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>566</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>567</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>gotoxy</span></u>(currcons,<u><span style='color:blue'>saved_x</span></u>,
<u><span style='color:blue'>saved_y</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>568</span></u><span
lang=EN-US> }</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>569</span></u><span
lang=EN-US> </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>570</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>这个枚举定义用于下面<span
lang=EN-US>con_write()</span>函数中处理转义序列或控制序列的解析。<span lang=EN-US>ESnormal</span>是初</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>始进入状态，也是转义或控制序列处理完毕时的状态。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESnormal -&nbsp; </span>表示处于初始正常状态。此时若接收到的是普通显示字符，则把字符直接显示</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>在屏幕上；若接收到的是控制字符（例如回车字符），则对光标位置进行设置。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>当刚处理完一个转义或控制序列，程序也会返回到本状态。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESesc&nbsp;&nbsp;&nbsp;
-&nbsp; </span>表示接收到转义序列引导字符<span lang=EN-US>ESC</span>（<span lang=EN-US>0x1b =
033 = 27</span>）；如果在此状态下接收</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>到一个<span
lang=EN-US>'['</span>字符，则说明转义序列引导码，于是跳转到<span lang=EN-US>ESsquare</span>去处理。否则</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>就把接收到的字符作为转义序列来处理。对于选择字符集转义序列<span
lang=EN-US>'ESC (' </span>和</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'ESC
)'</span>，我们使用单独的状态<span lang=EN-US>ESsetgraph</span>来处理；对于设备控制字符串序列</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'ESC
P'</span>，我们使用单独的状态<span lang=EN-US>ESsetterm</span>来处理。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESsquare -&nbsp; </span>表示已经接收到一个控制序列引导码（<span
lang=EN-US>'ESC ['</span>），表示接收到的是一个控制序</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>列。于是本状态执行参数数组<span
lang=EN-US>par[]</span>清零初始化工作。如果此时接收到的又是一</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>个<span
lang=EN-US>'['</span>字符，则表示收到了<span lang=EN-US>'ESC [['</span>序列。该序列是键盘功能键发出的序列，于</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>是跳转到
<span lang=EN-US>Esfunckey </span>去处理。否则我们需要准备接收控制序列的参数，于是置</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>状态<span
lang=EN-US>Esgetpars</span>并直接进入该状态去接收并保存序列的参数字符。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESgetpars - </span>该状态表示我们此时要接收控制序列的参数值。参数用十进制数表示，我们把</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>接收到的数字字符转换成数值并保存到<span
lang=EN-US>par[]</span>数组中。如果收到一个分号 <span lang=EN-US>';'</span>，</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>则还是维持在本状态，并把接收到的参数值保存在数据<span
lang=EN-US>par[]</span>下一项中。若不是</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>数字字符或分号，说明已取得所有参数，那么就转移到状态<span
lang=EN-US>ESgotpars</span>去处理。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESgotpars - </span>表示我们已经接收到一个完整的控制序列。此时我们可以根据本状态接收到的结</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>尾字符对相应控制序列进行处理。不过在处理之前，如果我们在<span
lang=EN-US>ESsquare </span>状态</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>收到过
<span lang=EN-US>'?'</span>，说明这个序列是终端设备私有序列。本内核不对支持对这种序列的</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>处理，于是我们直接恢复到
<span lang=EN-US>ESnormal </span>状态。否则就去执行相应控制序列。待序</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>列处理完后就把状态恢复到
<span lang=EN-US>ESnormal</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESfunckey - </span>表示我们接收到了键盘上功能键发出的一个序列。我们不用显示。于是恢复到正</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>常状态<span
lang=EN-US>ESnormal</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESsetterm - </span>表示处于设备控制字符串序列状态（<span
lang=EN-US>DCS</span>）。此时若收到字符 <span lang=EN-US>'S'</span>，则恢复初始</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>的显示字符属性。若收到的字符是<span
lang=EN-US>'L'</span>或<span lang=EN-US>'l'</span>，则开启或关闭折行显示方式。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESsetgraph -</span>表示收到设置字符集转移序列<span
lang=EN-US>'ESC (' </span>或 <span lang=EN-US>'ESC )'</span>。它们分别用于指定<span
lang=EN-US>G0</span>和<span lang=EN-US>G1</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>所用的字符集。此时若收到字符
<span lang=EN-US>'0'</span>，则选择图形字符集作为<span lang=EN-US>G0</span>和<span
lang=EN-US>G1</span>，若收到</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>的字符是
<span lang=EN-US>'B'</span>，这选择普通<span lang=EN-US>ASCII</span>字符集作为<span
lang=EN-US>G0</span>和<span lang=EN-US>G1</span>的字符集。</p>

<p class=a><u><span lang=EN-US style='color:blue'>571</span></u><span
lang=EN-US> enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey, </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>572</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ESsetterm,
ESsetgraph };</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>573</span></u><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>控制台写函数。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>从终端对应的<span
lang=EN-US>tty</span>写缓冲队列中取字符，针对每个字符进行分析。若是控制字符或转义或控制</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>序列，则进行光标定位、字符删除等的控制处理；对于普通字符就直接在光标处显示。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数 <span lang=EN-US>tty</span>是当前控制台使用的<span
lang=EN-US>tty</span>结构指针。</p>

<p class=a><u><span lang=EN-US style='color:blue'>574</span></u><span
lang=EN-US> void <u><span style='color:blue'>con_write</span></u>(struct <u><span
style='color:blue'>tty_struct</span></u> * tty)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>575</span></u><span
lang=EN-US> {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>576</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int nr;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>577</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char c;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>578</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int currcons;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>579</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>该函数首先根据当前控制台使用的<span
lang=EN-US>tty</span>在<span lang=EN-US>tty</span>表中的项位置取得对应的控制台号<span
lang=EN-US>currcons</span>，</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后计算出（<span
lang=EN-US>CHARS()</span>）目前<span lang=EN-US>tty</span>写队列中含有的字符数<span
lang=EN-US>nr</span>，并循环取出其中的每个字符进行</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>处理。不过如果当前控制台由于接收到键盘或程序发出的暂停命令（如按键<span
lang=EN-US>Ctrl-S</span>）而处于</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>停止状态，那么本函数就停止处理写队列中的字符，退出函数。另外，如果取出的是控制字符</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // CAN</span>（<span lang=EN-US>24</span>）或<span
lang=EN-US> SUB</span>（<span lang=EN-US>26</span>），那么<span style='color:black'>若是在转义或控制序列期间收到的，则序列不会执行而立刻终</span></p>

<p class=a><span lang=EN-US style='color:black'>&nbsp;&nbsp;&nbsp; // </span><span
style='color:black'>止，同时显示随后的字符。注意，<span lang=EN-US>con_write()</span>函数只处理取队列字符数时写队列中当前含有</span></p>

<p class=a><span lang=EN-US style='color:black'>&nbsp;&nbsp;&nbsp; // </span><span
style='color:black'>的字符。这有可能在一个序列被放到写队列期间读取字符数，因此本函数前一次退出时<span lang=EN-US>state</span></span></p>

<p class=a><span lang=EN-US style='color:black'>&nbsp;&nbsp;&nbsp; // </span><span
style='color:black'>有可能正处于处理转义或控制序列的其他状态上。</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>580</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currcons = tty - <u><span
style='color:blue'>tty_table</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>581</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((currcons&gt;=<u><span
style='color:blue'>MAX_CONSOLES</span></u>) || (currcons&lt;0))</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>582</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>panic</span></u>(<i>&quot;con_write: illegal
tty&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>583</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>584</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nr = <u><span
style='color:blue'>CHARS</span></u>(tty-&gt;write_q);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>取写队列中字符数。在<span lang=EN-US>tty.h</span>文件中。</p>

<p class=a><u><span lang=EN-US style='color:blue'>585</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (nr--) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>586</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (tty-&gt;stopped)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>587</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>588</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>GETCH</span></u>(tty-&gt;write_q,c);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>取<span lang=EN-US>1</span>字符到<span lang=EN-US>c</span>中。</p>

<p class=a><u><span lang=EN-US style='color:blue'>589</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (c == 24 || c == 26)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // </span>控制字符<span
lang=EN-US> CAN</span>、<span lang=EN-US>SUB -&nbsp; </span>取消、替换。</p>

<p class=a><u><span lang=EN-US style='color:blue'>590</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> = ESnormal;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>591</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
switch(<u><span style='color:blue'>state</span></u>) {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果从写队列中取出的字符是普通显示字符代码，就直接从当前映射字符集中取出对应的显示</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>字符，并放到当前光标所处的显示内存位置处，即直接显示该字符。然后把光标位置右移一个</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>字符位置。具体地，如果字符不是控制字符也不是扩展字符，即<span
lang=EN-US>(31&lt;c&lt;127)</span>，那么，若当前光</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>标处在行末端或末端以外，则将光标移到下行头列。并调整光标位置对应的内存指针<span
lang=EN-US>pos</span>。然</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>后将字符<span lang=EN-US>c</span>写到显示内存中<span
lang=EN-US>pos</span>处，并将光标右移<span lang=EN-US>1</span>列，同时也将<span lang=EN-US>pos</span>对应地移动<span
lang=EN-US>2</span>个字节。</p>

<p class=a><u><span lang=EN-US style='color:blue'>592</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case ESnormal:</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>593</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (c&gt;31 &amp;&amp; c&lt;127) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>是普通显示字符。</p>

<p class=a><u><span lang=EN-US style='color:blue'>594</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>x</span></u>&gt;=<u><span style='color:blue'>video_num_columns</span></u>)
{&nbsp;&nbsp;&nbsp;&nbsp; // </span>要换行？</p>

<p class=a><u><span lang=EN-US style='color:blue'>595</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>x</span></u> -= <u><span style='color:blue'>video_num_columns</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>596</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> -= <u><span style='color:blue'>video_size_row</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>597</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>lf</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>598</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>599</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__asm__(<i>&quot;movb %2,%%ah\n\t&quot;</i>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;// </span>写字符。</p>

<p class=a><u><span lang=EN-US style='color:blue'>600</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movw %%ax,%1\n\t&quot;</i></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>601</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::<i>&quot;a&quot;</i> (<u><span style='color:blue'>translate</span></u>[c-32]),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>602</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;m&quot;</i> (*(short *)<u><span style='color:blue'>pos</span></u>),</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>603</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>&quot;m&quot;</i>
(<u><span style='color:blue'>attr</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>604</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;ax&quot;</i>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>605</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> += 2;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>606</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>x</span></u>++;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是转义字符<span
lang=EN-US>ESC</span>，则转换状态<span lang=EN-US>state</span>到<span lang=EN-US>ESesc</span>（<span
lang=EN-US>637</span>行）。</p>

<p class=a><u><span lang=EN-US style='color:blue'>607</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} else if (c==27)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC - </span>转义控制字符。</p>

<p class=a><u><span lang=EN-US style='color:blue'>608</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u>=ESesc;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是换行符<span
lang=EN-US>LF(10)</span>，或垂直制表符<span lang=EN-US>VT(11)</span>，或换页符<span
lang=EN-US>FF(12)</span>，则光标移动到下<span lang=EN-US>1</span>行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>609</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else if (c==10 || c==11 || c==12)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>610</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>lf</span></u>(currcons);</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是回车符<span
lang=EN-US>CR(13)</span>，则将光标移动到头列（<span lang=EN-US>0</span>列）。</p>

<p class=a><u><span lang=EN-US style='color:blue'>611</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else if (c==13)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// CR - </span>回车。</p>

<p class=a><u><span lang=EN-US style='color:blue'>612</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>cr</span></u>(currcons);</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>DEL(127)</span>，则将光标左边字符擦除<span lang=EN-US>(</span>用空格字符替代<span
lang=EN-US>)</span>，并将光标移到被擦除位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>613</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else if (c==<u><span style='color:blue'>ERASE_CHAR</span></u>(tty))</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>614</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>del</span></u>(currcons);</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>BS(backspace,8)</span>，则将光标左移<span lang=EN-US>1</span>格，并相应调整光标对应内存位置指针<span
lang=EN-US>pos</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>615</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else if (c==8) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// BS - </span>后退。</p>

<p class=a><u><span lang=EN-US style='color:blue'>616</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>x</span></u>) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>617</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>x</span></u>--;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>618</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;<u><span style='color:blue'>pos</span></u> -= 2;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>619</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是水平制表符<span
lang=EN-US>HT(9)</span>，则将光标移到<span lang=EN-US>8</span>的倍数列上。若此时光标列数超出屏幕最大</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>列数，则将光标移到下一行上。</p>

<p class=a><u><span lang=EN-US style='color:blue'>620</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} else if (c==9) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// HT - </span>水平制表。</p>

<p class=a><u><span
 lang=EN-US style='color:blue'>621</span></u><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 c</span><span lang=EN-US>=8-(<u><span style='color:blue'>x</span></u>&amp;7);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>622</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>x</span></u> += c;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>623</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> += c&lt;&lt;1;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>624</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>x</span></u>&gt;<u><span style='color:blue'>video_num_columns</span></u>)
{</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>625</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>x</span></u> -= <u><span style='color:blue'>video_num_columns</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>626</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> -= <u><span style='color:blue'>video_size_row</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>627</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>lf</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>628</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><u><span
 lang=EN-US style='color:blue'>629</span></u><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 c</span><span lang=EN-US>=9;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是响铃符<span
lang=EN-US>BEL(7)</span>，则调用蜂鸣函数，是扬声器发声。</p>

<p class=a><u><span lang=EN-US style='color:blue'>630</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} else if (c==7)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// BEL - </span>响铃。</p>

<p class=a><u><span lang=EN-US style='color:blue'>631</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>sysbeep</span></u>();</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是控制字符<span
lang=EN-US>SO</span>（<span lang=EN-US>14</span>）或<span lang=EN-US>SI</span>（<span
lang=EN-US>15</span>），则相应选择字符集<span lang=EN-US>G1</span>或<span lang=EN-US>G0</span>作为显示字符集。</p>

<p class=a><u><span lang=EN-US style='color:blue'>632</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (c == 14)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// SO - </span>换出，使用<span lang=EN-US>G1</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>633</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>translate</span></u> = <u><span style='color:blue'>GRAF_TRANS</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>634</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else if (c == 15)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// SI - </span>换进，使用<span lang=EN-US>G0</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>635</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>translate</span></u> = <u><span style='color:blue'>NORM_TRANS</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>636</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果在<span lang=EN-US>ESnormal</span>状态收到转义字符<span
lang=EN-US>ESC(0x1b = 033 = 27)</span>，则转到本状态处理。该状态对<span lang=EN-US>C1</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>中控制字符或转义字符进行处理。处理完后默认的状态将是<span
lang=EN-US>ESnormal</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>637</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case ESesc:</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>638</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> = ESnormal;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>639</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
switch (c)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>640</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>641</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'['</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC [ - </span>是<span lang=EN-US>CSI</span>序列。</p>

<p class=a><u><span lang=EN-US style='color:blue'>642</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u>=ESsquare;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>643</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>644</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'E'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC E - </span>光标下移<span lang=EN-US>1</span>行回<span lang=EN-US>0</span>列。</p>

<p class=a><u><span lang=EN-US style='color:blue'>645</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,0,<u><span
style='color:blue'>y</span></u>+1);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>646</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>647</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case
<i>'M'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC M - </span>光标下移<span lang=EN-US>1</span>行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>648</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>ri</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>649</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>650</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'D'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC D - </span>光标下移<span lang=EN-US>1</span>行。</p>

<p class=a><u><span lang=EN-US style='color:blue'>651</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>lf</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>652</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>653</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'Z'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC Z - </span>设备属性查询。</p>

<p class=a><u><span lang=EN-US style='color:blue'>654</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>respond</span></u>(currcons,tty);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>655</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>656</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'7'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC 7 - </span>保存光标位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>657</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>save_cur</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>658</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>659</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case
<i>'8'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC 8 - </span>恢复保存的光标原位置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>660</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>restore_cur</span></u>(currcons);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>661</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>662</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'('</i>:&nbsp; case <i>')'</i>: // ESC (</span>、<span lang=EN-US>ESC )
- </span>选择字符集。</p>

<p class=a><u><span lang=EN-US style='color:blue'>663</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> =
ESsetgraph;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>664</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>665</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'P'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC P - </span>设置终端参数。</p>

<p class=a><u><span lang=EN-US style='color:blue'>666</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>state</span></u> = ESsetterm;&nbsp; </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>667</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>668</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'#'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC # - </span>修改整行属性。</p>

<p class=a><u><span lang=EN-US style='color:blue'>669</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> = -1;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>670</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;break;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>671</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'c'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ESC c - </span>复位到终端初始设置。</p>

<p class=a><u><span lang=EN-US style='color:blue'>672</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
tty-&gt;<u><span style='color:blue'>termios</span></u> = <u><span
style='color:blue'>DEF_TERMIOS</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>673</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> = <u><span style='color:blue'>restate</span></u>
= ESnormal;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>674</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>checkin</span></u> = 0;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>675</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>top</span></u> = 0;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>676</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>bottom</span></u> = <u><span style='color:blue'>video_num_lines</span></u>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>677</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>678</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* case '&gt;':&nbsp;&nbsp; Numeric keypad */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>679</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* case '=':&nbsp;&nbsp; Appl. keypad */</i></b></span></p>

<p class=a><u><span lang=EN-US style='color:blue'>680</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>681</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果在状态<span lang=EN-US>ESesc</span>（是转义字符<span
lang=EN-US>ESC</span>）时收到字符<span lang=EN-US>'['</span>，则表明是<span lang=EN-US>CSI</span>控制序列，于是转到状</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>态<span lang=EN-US>ESsequare</span>来处理。首先对<span
lang=EN-US>ESC</span>转义序列保存参数的数组<span lang=EN-US>par[]</span>清零，索引变量<span
lang=EN-US>npar</span>指向</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>首项，并且设置我们开始处于取参数状态<span
lang=EN-US>ESgetpars</span>。如果接收到的字符不是<span lang=EN-US>'?'</span>，则直接转</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>到状态<span lang=EN-US>ESgetpars</span>去处理，若接收到的字符是<span
lang=EN-US>'?'</span>，说明这个序列是终端设备私有序列，后面</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>会有一个功能字符。于是去读下一字符，再到状态
<span lang=EN-US>ESgetpars </span>去处理代码处。如果此时接收</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>到的字符还是<span
lang=EN-US>'['</span>，那么表明收到了键盘功能键发出的序列，于是设置下一状态为<span lang=EN-US>ESfunckey</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>否则直接进入<span
lang=EN-US>ESgetpars</span>状态继续处理。</p>

<p class=a><u><span lang=EN-US style='color:blue'>682</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case ESsquare:</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>683</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
for(<u><span style='color:blue'>npar</span></u>=0;<u><span style='color:blue'>npar</span></u>&lt;<u><span
style='color:blue'>NPAR</span></u>;<u><span style='color:blue'>npar</span></u>++)&nbsp;&nbsp;&nbsp;&nbsp;
// </span>初始化参数数组。</p>

<p class=a><u><span lang=EN-US style='color:blue'>684</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>par</span></u>[<u><span style='color:blue'>npar</span></u>]=0;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>685</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>npar</span></u>=0;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>686</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u>=ESgetpars;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>687</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (c ==<i>'['</i>)&nbsp; <b><i>/* Function key */</i></b> // 'ESC [['</span>是功能键。</p>

<p class=a><u><span lang=EN-US style='color:blue'>688</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{ <u><span style='color:blue'>state</span></u>=ESfunckey;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>689</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>690</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp; </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>691</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>ques</span></u>=(c==<i>'?'</i>))</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>692</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>该状态表示我们此时要接收控制序列的参数值。参数用十进制数表示，我们把接收到的数字字</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>符转换成数值并保存到<span
lang=EN-US>par[]</span>数组中。如果收到一个分号 <span lang=EN-US>';'</span>，则还是维持在本状态，并把接</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>收到的参数值保存在数据<span
lang=EN-US>par[]</span>下一项中。若不是数字字符或分号，说明已取得所有参数，那</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>么就转移到状态<span
lang=EN-US>ESgotpars</span>去处理。</p>

<p class=a><u><span lang=EN-US style='color:blue'>693</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case ESgetpars:</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>694</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (c==<i>';'</i> &amp;&amp; <u><span style='color:blue'>npar</span></u>&lt;<u><span
style='color:blue'>NPAR</span></u>-1) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>695</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>npar</span></u>++;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>696</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>697</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} else if (c&gt;=<i>'0'</i> &amp;&amp; c&lt;=<i>'9'</i>) {</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>698</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>par</span></u>[<u><span style='color:blue'>npar</span></u>]=10*<u><span
style='color:blue'>par</span></u>[<u><span style='color:blue'>npar</span></u>]+c-<i>'0'</i>;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>699</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>700</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} else <u><span style='color:blue'>state</span></u>=ESgotpars;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESgotpars</span>状态表示我们已经接收到一个完整的控制序列。此时我们可以根据本状态接收到的</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>结尾字符对相应控制序列进行处理。不过在处理之前，如果我们在<span
lang=EN-US>ESsquare </span>状态收到过<span lang=EN-US>'?'</span>，</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>说明这个序列是终端设备私有序列。本内核不支持对这种序列的处理，于是我们直接恢复到</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // ESnormal </span>状态。否则就去执行相应控制序列。待序列处理完后就把状态恢复到
<span lang=EN-US>ESnormal</span>。</p>

<p class=a><u><span lang=EN-US style='color:blue'>701</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case ESgotpars:</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>702</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> = ESnormal;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>703</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>ques</span></u>)</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>704</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{ <u><span style='color:blue'>ques</span></u> =0;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>705</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>706</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp; </span></p>

<p class=a><u><span lang=EN-US style='color:blue'>707</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
switch(c) {</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是字符<span
lang=EN-US>'G'</span>或<span lang=EN-US>'`'</span>，则<span lang=EN-US>par[]</span>中第<span
lang=EN-US>1</span>个参数代表列号。若列号不为零，则将光标左移<span lang=EN-US>1</span>格。</p>

<p class=a><u><span lang=EN-US style='color:blue'>708</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'G'</i>: case <i>'`'</i>:&nbsp; // CSI Pn G -</span>光标水平移动。</p>

<p class=a><u><span lang=EN-US style='color:blue'>709</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
(<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]--;</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>710</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,<u><span
style='color:blue'>par</span></u>[0],<u><span style='color:blue'>y</span></u>);</span></p>

<p class=a><u><span lang=EN-US style='color:blue'>711</span></u><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>'A'</span>，则第<span lang=EN-US>1</span>个参数代表光标上移的行数。若参数为<span
lang=EN-US>0</span>则上移<span lang=EN-US>1</span>行。</p>

<p class=a><a name=L712><u><span lang=EN-US style='color:blue'>712</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'A'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// CSI Pn A - </span>光标上移。</p>

<p class=a><a name=L713><u><span lang=EN-US style='color:blue'>713</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]++;</span></p>

<p class=a><a name=L714><u><span lang=EN-US style='color:blue'>714</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,<u><span
style='color:blue'>x</span></u>,<u><span style='color:blue'>y</span></u>-<u><span
style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L715><u><span lang=EN-US style='color:blue'>715</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>'B'</span>或<span lang=EN-US>'e'</span>，则第<span lang=EN-US>1</span>个参数代表光标下移的行数。若参数为<span
lang=EN-US>0</span>则下移<span lang=EN-US>1</span>行。</p>

<p class=a><a name=L716><u><span lang=EN-US style='color:blue'>716</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'B'</i>: case <i>'e'</i>:&nbsp; // CSI Pn B - </span>光标下移。</p>

<p class=a><a name=L717><u><span lang=EN-US style='color:blue'>717</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]++;</span></p>

<p class=a><a name=L718><u><span lang=EN-US style='color:blue'>718</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>gotoxy</span></u>(currcons,<u><span style='color:blue'>x</span></u>,<u><span
style='color:blue'>y</span></u>+<u><span style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L719><u><span lang=EN-US style='color:blue'>719</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>'C'</span>或<span lang=EN-US>'a'</span>，则第<span lang=EN-US>1</span>个参数代表光标右移的格数。若参数为<span
lang=EN-US>0</span>则右移<span lang=EN-US>1</span>格。</p>

<p class=a><a name=L720><u><span lang=EN-US style='color:blue'>720</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'C'</i>: case <i>'a'</i>:&nbsp; // CSI Pn C - </span>光标右移。</p>

<p class=a><a name=L721><u><span lang=EN-US style='color:blue'>721</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]++;</span></p>

<p class=a><a name=L722><u><span lang=EN-US style='color:blue'>722</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,<u><span
style='color:blue'>x</span></u>+<u><span style='color:blue'>par</span></u>[0],<u><span
style='color:blue'>y</span></u>);</span></p>

<p class=a><a name=L723><u><span lang=EN-US style='color:blue'>723</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>'D'</span>，则第<span lang=EN-US>1</span>个参数代表光标左移的格数。若参数为<span
lang=EN-US>0</span>则左移<span lang=EN-US>1</span>格。</p>

<p class=a><a name=L724><u><span lang=EN-US style='color:blue'>724</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'D'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// CSI Pn D - </span>光标左移。</p>

<p class=a><a name=L725><u><span lang=EN-US style='color:blue'>725</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]++;</span></p>

<p class=a><a name=L726><u><span lang=EN-US style='color:blue'>726</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,<u><span
style='color:blue'>x</span></u>-<u><span style='color:blue'>par</span></u>[0],<u><span
style='color:blue'>y</span></u>);</span></p>

<p class=a><a name=L727><u><span lang=EN-US style='color:blue'>727</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>'E'</span>，则第<span lang=EN-US>1</span>个参数代表光标向下移动的行数，并回到<span
lang=EN-US>0</span>列。若参数为<span lang=EN-US>0</span>则下移<span lang=EN-US>1</span>行。</p>

<p class=a><a name=L728><u><span lang=EN-US style='color:blue'>728</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'E'</i>:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;// CSI Pn E - </span>光标下移回<span
lang=EN-US>0</span>列。</p>

<p class=a><a name=L729><u><span lang=EN-US style='color:blue'>729</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]++;</span></p>

<p class=a><a name=L730><u><span lang=EN-US style='color:blue'>730</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,0,<u><span
style='color:blue'>y</span></u>+<u><span style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L731><u><span lang=EN-US style='color:blue'>731</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>'F'</span>，则第<span lang=EN-US>1</span>个参数代表光标向上移动的行数，并回到<span
lang=EN-US>0</span>列。若参数为<span lang=EN-US>0</span>则上移<span lang=EN-US>1</span>行。</p>

<p class=a><a name=L732><u><span lang=EN-US style='color:blue'>732</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'F'</i>:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;// CSI Pn F - </span>光标上移回<span
lang=EN-US>0</span>列。</p>

<p class=a><a name=L733><u><span lang=EN-US style='color:blue'>733</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]++;</span></p>

<p class=a><a name=L734><u><span lang=EN-US style='color:blue'>734</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,0,<u><span
style='color:blue'>y</span></u>-<u><span style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L735><u><span lang=EN-US style='color:blue'>735</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>'d'</span>，则第<span lang=EN-US>1</span>个参数代表光标所需在的行号（从<span
lang=EN-US>0</span>计数）。</p>

<p class=a><a name=L736><u><span lang=EN-US style='color:blue'>736</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'d'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // CSI Pn d - </span>在当前列置行位置。</p>

<p class=a><a name=L737><u><span lang=EN-US style='color:blue'>737</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]--;</span></p>

<p class=a><a name=L738><u><span lang=EN-US style='color:blue'>738</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,<u><span
style='color:blue'>x</span></u>,<u><span style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L739><u><span lang=EN-US style='color:blue'>739</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>c</span>是<span
lang=EN-US>'H'</span>或<span lang=EN-US>'f'</span>，则第<span lang=EN-US>1</span>个参数代表光标移到的行号，第<span
lang=EN-US>2</span>个参数代表光标移到的列号。</p>

<p class=a><a name=L740><u><span lang=EN-US style='color:blue'>740</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'H'</i>: case <i>'f'</i>:&nbsp; // CSI Pn H - </span>光标定位。</p>

<p class=a><a name=L741><u><span lang=EN-US style='color:blue'>741</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]--;</span></p>

<p class=a><a name=L742><u><span lang=EN-US style='color:blue'>742</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>par</span></u>[1]) <u><span style='color:blue'>par</span></u>[1]--;</span></p>

<p class=a><a name=L743><u><span lang=EN-US style='color:blue'>743</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,<u><span
style='color:blue'>par</span></u>[1],<u><span style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L744><u><span lang=EN-US style='color:blue'>744</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'J'</span>，则第<span lang=EN-US>1</span>个参数代表以光标所处位置清屏的方式：</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>序列：<span lang=EN-US>'ESC
[ Ps J'</span>（<span lang=EN-US>Ps=0 </span>删除光标到屏幕底端；<span lang=EN-US>1 </span>删除屏幕开始到光标处；<span
lang=EN-US>2 </span>整屏删除）。</p>

<p class=a><a name=L745><u><span lang=EN-US style='color:blue'>745</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'J'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // CSI Pn J - </span>屏幕擦除字符。</p>

<p class=a><a name=L746><u><span lang=EN-US style='color:blue'>746</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>csi_J</span></u>(currcons,<u><span style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L747><u><span lang=EN-US style='color:blue'>747</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'K'</span>，则第一个参数代表以光标所在位置对行中字符进行删除处理的方式。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>转义序列：<span lang=EN-US>'ESC
[ Ps K'</span>（<span lang=EN-US>Ps = 0 </span>删除到行尾；<span lang=EN-US>1 </span>从开始删除；<span
lang=EN-US>2 </span>整行都删除）。</p>

<p class=a><a name=L748><u><span lang=EN-US style='color:blue'>748</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'K'</i>:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;// CSI Pn K - </span>行内擦除字符。</p>

<p class=a><a name=L749><u><span lang=EN-US style='color:blue'>749</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>csi_K</span></u>(currcons,<u><span
style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L750><u><span lang=EN-US style='color:blue'>750</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'L'</span>，表示在光标位置处插入<span lang=EN-US>n</span>行（控制序列 <span
lang=EN-US>'ESC [ Pn L'</span>）。</p>

<p class=a><a name=L751><u><span lang=EN-US style='color:blue'>751</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'L'</i>:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;// CSI Pn L - </span>插入行。</p>

<p class=a><a name=L752><u><span lang=EN-US style='color:blue'>752</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>csi_L</span></u>(currcons,<u><span
style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L753><u><span lang=EN-US style='color:blue'>753</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'M'</span>，表示在光标位置处删除<span lang=EN-US>n</span>行（控制序列 <span
lang=EN-US>'ESC [ Pn M'</span>）。</p>

<p class=a><a name=L754><u><span lang=EN-US style='color:blue'>754</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'M'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // CSI Pn M - </span>删除行。</p>

<p class=a><a name=L755><u><span lang=EN-US style='color:blue'>755</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>csi_M</span></u>(currcons,<u><span
style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L756><u><span lang=EN-US style='color:blue'>756</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'P'</span>，表示在光标位置处删除<span lang=EN-US>n</span>个字符（控制序列 <span
lang=EN-US>'ESC [ Pn P'</span>）。</p>

<p class=a><a name=L757><u><span lang=EN-US style='color:blue'>757</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'P'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // CSI Pn P - </span>删除字符。</p>

<p class=a><a name=L758><u><span lang=EN-US style='color:blue'>758</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>csi_P</span></u>(currcons,<u><span
style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L759><u><span lang=EN-US style='color:blue'>759</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'@'</span>，表示在光标位置处插入<span lang=EN-US>n</span>个字符（控制序列 <span
lang=EN-US>'ESC [ Pn @' </span>）。</p>

<p class=a><a name=L760><u><span lang=EN-US style='color:blue'>760</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'@'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // CSI Pn @ - </span>插入字符。</p>

<p class=a><a name=L761><u><span lang=EN-US style='color:blue'>761</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>csi_at</span></u>(currcons,<u><span
style='color:blue'>par</span></u>[0]);</span></p>

<p class=a><a name=L762><u><span lang=EN-US style='color:blue'>762</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'m'</span>，表示改变光标处字符的显示属性，比如加粗、加下划线、闪烁、反显等。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>转义序列：<span lang=EN-US>'ESC
[ Pn m'</span>。<span lang=EN-US>n=0 </span>正常显示；<span lang=EN-US>1 </span>加粗；<span
lang=EN-US>4 </span>加下划线；<span lang=EN-US>7 </span>反显；<span lang=EN-US>27 </span>正常显示等。</p>

<p class=a><a name=L763><u><span lang=EN-US style='color:blue'>763</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'m'</i>:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;// CSI Ps m - </span>设置显示字符属性。</p>

<p class=a><a name=L764><u><span lang=EN-US style='color:blue'>764</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>csi_m</span></u>(currcons);</span></p>

<p class=a><a name=L765><u><span lang=EN-US style='color:blue'>765</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'r'</span>，则表示用两个参数设置滚屏的起始行号和终止行号。</p>

<p class=a><a name=L766><u><span lang=EN-US style='color:blue'>766</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'r'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // CSI Pn;Pn r - </span>设置滚屏上下界。</p>

<p class=a><a name=L767><u><span lang=EN-US style='color:blue'>767</span></u></a><span
lang=EN-US> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
(<u><span style='color:blue'>par</span></u>[0]) <u><span style='color:blue'>par</span></u>[0]--;</span></p>

<p class=a><a name=L768><u><span lang=EN-US style='color:blue'>768</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!<u><span style='color:blue'>par</span></u>[1]) <u><span style='color:blue'>par</span></u>[1]
= <u><span style='color:blue'>video_num_lines</span></u>;</span></p>

<p class=a><a name=L769><u><span lang=EN-US style='color:blue'>769</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>par</span></u>[0] &lt; <u><span
style='color:blue'>par</span></u>[1] &amp;&amp;</span></p>

<p class=a><a name=L770><u><span lang=EN-US style='color:blue'>770</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>par</span></u>[1] &lt;= <u><span style='color:blue'>video_num_lines</span></u>)
{</span></p>

<p class=a><a name=L771><u><span lang=EN-US style='color:blue'>771</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>top</span></u>=<u><span style='color:blue'>par</span></u>[0];</span></p>

<p class=a><a name=L772><u><span lang=EN-US style='color:blue'>772</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>bottom</span></u>=<u><span style='color:blue'>par</span></u>[1];</span></p>

<p class=a><a name=L773><u><span lang=EN-US style='color:blue'>773</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></p>

<p class=a><a name=L774><u><span lang=EN-US style='color:blue'>774</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'s'</span>，则表示保存当前光标所在位置。</p>

<p class=a><a name=L775><u><span lang=EN-US style='color:blue'>775</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'s'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // CSI s - </span>保存光标位置。</p>

<p class=a><a name=L776><u><span lang=EN-US style='color:blue'>776</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>save_cur</span></u>(currcons);</span></p>

<p class=a><a name=L777><u><span lang=EN-US style='color:blue'>777</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'u'</span>，则表示恢复光标到原保存的位置处。</p>

<p class=a><a name=L778><u><span lang=EN-US style='color:blue'>778</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'u'</i>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // CSI u - </span>恢复保存的光标位置。</p>

<p class=a><a name=L779><u><span lang=EN-US style='color:blue'>779</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>restore_cur</span></u>(currcons);</span></p>

<p class=a><a name=L780><u><span lang=EN-US style='color:blue'>780</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果字符<span lang=EN-US>c</span>是<span
lang=EN-US>'l'</span>或<span lang=EN-US>'b'</span>，则分别表示设置屏幕黑屏间隔时间和设置粗体字符显示。此时参数数</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>组中<span lang=EN-US>par[1]</span>和<span
lang=EN-US>par[2]</span>是特征值，它们分别必须为<span lang=EN-US>par[1]= par[0]+13</span>；<span
lang=EN-US>par[2]= par[0]+17</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>在这个条件下，如果<span
lang=EN-US>c</span>是字符<span lang=EN-US>'l'</span>，那么<span lang=EN-US>par[0]</span>中是开始黑屏时说延迟的分钟数；如果<span
lang=EN-US>c</span>是</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>字符<span lang=EN-US>'b'</span>，那么<span
lang=EN-US>par[0]</span>中是设置的粗体字符属性值。</p>

<p class=a><a name=L781><u><span lang=EN-US style='color:blue'>781</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'l'</i>: <b><i>/* blank interval */</i></b></span></p>

<p class=a><a name=L782><u><span lang=EN-US style='color:blue'>782</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case <i>'b'</i>: <b><i>/* bold attribute */</i></b></span></p>

<p class=a><a name=L783><u><span lang=EN-US style='color:blue'>783</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (!((<u><span style='color:blue'>npar</span></u> &gt;= 2) &amp;&amp;</span></p>

<p class=a><a name=L784><u><span lang=EN-US style='color:blue'>784</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((<u><span
style='color:blue'>par</span></u>[1]-13) == <u><span style='color:blue'>par</span></u>[0])
&amp;&amp; </span></p>

<p class=a><a name=L785><u><span lang=EN-US style='color:blue'>785</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
((<u><span style='color:blue'>par</span></u>[2]-17) == <u><span
style='color:blue'>par</span></u>[0]))) </span></p>

<p class=a><a name=L786><u><span lang=EN-US style='color:blue'>786</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><a name=L787><u><span lang=EN-US style='color:blue'>787</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if ((c==<i>'l'</i>)&amp;&amp;(<u><span style='color:blue'>par</span></u>[0]&gt;=0)&amp;&amp;(<u><span
style='color:blue'>par</span></u>[0]&lt;=60))</span></p>

<p class=a><a name=L788><u><span lang=EN-US style='color:blue'>788</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{&nbsp; </span></p>

<p class=a><a name=L789><u><span lang=EN-US style='color:blue'>789</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>blankinterval</span></u> = <u><span
style='color:blue'>HZ</span></u>*60*<u><span style='color:blue'>par</span></u>[0];</span></p>

<p class=a><a name=L790><u><span lang=EN-US style='color:blue'>790</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>blankcount</span></u> = <u><span style='color:blue'>blankinterval</span></u>;</span></p>

<p class=a><a name=L791><u><span lang=EN-US style='color:blue'>791</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><a name=L792><u><span lang=EN-US style='color:blue'>792</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (c==<i>'b'</i>)</span></p>

<p class=a><a name=L793><u><span lang=EN-US style='color:blue'>793</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>vc_cons</span></u>[currcons].vc_bold_attr</span></p>

<p class=a><a name=L794><u><span lang=EN-US style='color:blue'>794</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= <u><span style='color:blue'>par</span></u>[0];</span></p>

<p class=a><a name=L795><u><span lang=EN-US style='color:blue'>795</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><a name=L796><u><span lang=EN-US style='color:blue'>796</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>状态<span lang=EN-US>ESfunckey</span>表示我们接收到了键盘上功能键发出的一个序列。我们不用显示。于是恢复到</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>正常状态<span lang=EN-US>ESnormal</span>。</p>

<p class=a><a name=L797><u><span lang=EN-US style='color:blue'>797</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case
ESfunckey:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>键盘功能键码。</p>

<p class=a><a name=L798><u><span lang=EN-US style='color:blue'>798</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> = ESnormal;</span></p>

<p class=a><a name=L799><u><span lang=EN-US style='color:blue'>799</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>状态<span lang=EN-US>ESsetterm</span>表示处于设备控制字符串序列状态（<span
lang=EN-US>DCS</span>）。此时若收到字符 <span lang=EN-US>'S'</span>，则恢复初</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>始的显示字符属性。若收到的字符是<span
lang=EN-US>'L'</span>或<span lang=EN-US>'l'</span>，则开启或关闭折行显示方式。</p>

<p class=a><a name=L800><u><span lang=EN-US style='color:blue'>800</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case ESsetterm:&nbsp; <b><i>/* Setterm functions. */</i></b></span></p>

<p class=a><a name=L801><u><span lang=EN-US style='color:blue'>801</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> = ESnormal;</span></p>

<p class=a><a name=L802><u><span lang=EN-US style='color:blue'>802</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (c == <i>'S'</i>) {</span></p>

<p class=a><a name=L803><u><span lang=EN-US style='color:blue'>803</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>def_attr</span></u> = <u><span style='color:blue'>attr</span></u>;</span></p>

<p class=a><a name=L804><u><span lang=EN-US style='color:blue'>804</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>video_erase_char</span></u> = (<u><span style='color:blue'>video_erase_char</span></u>&amp;0x0ff)
| </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<u><span style='color:blue'>def_attr</span></u>&lt;&lt;8);</span></p>

<p class=a><a name=L805><u><span lang=EN-US style='color:blue'>805</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} else if (c == <i>'L'</i>)</span></p>

<p class=a><a name=L806><u><span lang=EN-US style='color:blue'>806</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; <b><i>/*linewrap
on*/</i></b></span></p>

<p class=a><a name=L807><u><span lang=EN-US style='color:blue'>807</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else if (c == <i>'l'</i>)</span></p>

<p class=a><a name=L808><u><span lang=EN-US style='color:blue'>808</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
; <b><i>/*linewrap off*/</i></b></span></p>

<p class=a><a name=L809><u><span lang=EN-US style='color:blue'>809</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>状态<span lang=EN-US>ESsetgraph</span>表示收到设置字符集转移序列<span
lang=EN-US>'ESC (' </span>或 <span lang=EN-US>'ESC )'</span>。它们分别用于指定<span
lang=EN-US>G0</span>和</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // G1</span>所用的字符集。此时若收到字符<span
lang=EN-US>'0'</span>，则选择图形字符集作为<span lang=EN-US>G0</span>和<span lang=EN-US>G1</span>，若收到的字符是<span
lang=EN-US>'B'</span>，</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>则选择普通<span lang=EN-US>ASCII</span>字符集作为<span
lang=EN-US>G0</span>和<span lang=EN-US>G1</span>的字符集。</p>

<p class=a><a name=L810><u><span lang=EN-US style='color:blue'>810</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
case ESsetgraph:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 'CSI ( 0'</span>或<span
lang=EN-US>'CSI ( B' - </span>选择字符集。</p>

<p class=a><a name=L811><u><span lang=EN-US style='color:blue'>811</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> = ESnormal;</span></p>

<p class=a><a name=L812><u><span lang=EN-US style='color:blue'>812</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (c == <i>'0'</i>)</span></p>

<p class=a><a name=L813><u><span lang=EN-US style='color:blue'>813</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>translate</span></u> = <u><span style='color:blue'>GRAF_TRANS</span></u>;</span></p>

<p class=a><a name=L814><u><span lang=EN-US style='color:blue'>814</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else if (c == <i>'B'</i>)</span></p>

<p class=a><a name=L815><u><span lang=EN-US style='color:blue'>815</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>translate</span></u> = <u><span style='color:blue'>NORM_TRANS</span></u>;</span></p>

<p class=a><a name=L816><u><span lang=EN-US style='color:blue'>816</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</span></p>

<p class=a><a name=L817><u><span lang=EN-US style='color:blue'>817</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
default:</span></p>

<p class=a><a name=L818><u><span lang=EN-US style='color:blue'>818</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>state</span></u> = ESnormal;</span></p>

<p class=a><a name=L819><u><span lang=EN-US style='color:blue'>819</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><a name=L820><u><span lang=EN-US style='color:blue'>820</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><a name=L821><u><span lang=EN-US style='color:blue'>821</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>set_cursor</span></u>(currcons);&nbsp; // </span>最后根据上面设置的光标位置，设置显示控制器中光标位置。</p>

<p class=a><a name=L822><u><span lang=EN-US style='color:blue'>822</span></u></a><span
lang=EN-US> }</span></p>

<p class=a><a name=L823><u><span lang=EN-US style='color:blue'>823</span></u></a><span
lang=EN-US> </span></p>

<p class=a><a name=L824><u><span lang=EN-US style='color:blue'>824</span></u></a><span
lang=EN-US> <b><i>/*</i></b></span></p>

<p class=a><a name=L825><u><span lang=EN-US style='color:blue'>825</span></u></a><span
lang=EN-US> <b><i>&nbsp;*&nbsp; void con_init(void);</i></b></span></p>

<p class=a><a name=L826><u><span lang=EN-US style='color:blue'>826</span></u></a><span
lang=EN-US> <b><i>&nbsp;*</i></b></span></p>

<p class=a><a name=L827><u><span lang=EN-US style='color:blue'>827</span></u></a><span
lang=EN-US> <b><i>&nbsp;* This routine initalizes console interrupts, and does
nothing</i></b></span></p>

<p class=a><a name=L828><u><span lang=EN-US style='color:blue'>828</span></u></a><span
lang=EN-US> <b><i>&nbsp;* else. If you want the screen to clear, call tty_write
with</i></b></span></p>

<p class=a><a name=L829><u><span lang=EN-US style='color:blue'>829</span></u></a><span
lang=EN-US> <b><i>&nbsp;* the appropriate escape-sequece.</i></b></span></p>

<p class=a><a name=L830><u><span lang=EN-US style='color:blue'>830</span></u></a><span
lang=EN-US> <b><i>&nbsp;*</i></b></span></p>

<p class=a><a name=L831><u><span lang=EN-US style='color:blue'>831</span></u></a><span
lang=EN-US> <b><i>&nbsp;* Reads the information preserved by setup.s to
determine the current display</i></b></span></p>

<p class=a><a name=L832><u><span lang=EN-US style='color:blue'>832</span></u></a><span
lang=EN-US> <b><i>&nbsp;* type and sets everything accordingly.</i></b></span></p>

<p class=a><a name=L833><u><span lang=EN-US style='color:blue'>833</span></u></a><span
lang=EN-US> <b><i>&nbsp;*/</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; /*</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * void con_init(void);</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>这个子程序初始化控制台中断，其他什么都不做。如果你想让屏幕干净的话，就使用</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>适当的转义字符序列调用<span
lang=EN-US>tty_write()</span>函数。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; *</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; * </span>读取<span
lang=EN-US>setup.s</span>程序保存的信息，用以确定当前显示器类型，并且设置所有相关参数。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp; */</span></p>

<p class=a><a name=L834><u><span lang=EN-US style='color:blue'>834</span></u></a><span
lang=EN-US> void <u><span style='color:blue'>con_init</span></u>(void)</span></p>

<p class=a><a name=L835><u><span lang=EN-US style='color:blue'>835</span></u></a><span
lang=EN-US> {</span></p>

<p class=a><a name=L836><u><span lang=EN-US style='color:blue'>836</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; register unsigned
char a;</span></p>

<p class=a><a name=L837><u><span lang=EN-US style='color:blue'>837</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *display_desc
= <i>&quot;????&quot;</i>;</span></p>

<p class=a><a name=L838><u><span lang=EN-US style='color:blue'>838</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *display_ptr;</span></p>

<p class=a><a name=L839><u><span lang=EN-US style='color:blue'>839</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int currcons = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>当前虚拟控制台号。</p>

<p class=a><a name=L840><u><span lang=EN-US style='color:blue'>840</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long base, <u><span
style='color:blue'>term</span></u>;</span></p>

<p class=a><a name=L841><u><span lang=EN-US style='color:blue'>841</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long video_memory;</span></p>

<p class=a><a name=L842><u><span lang=EN-US style='color:blue'>842</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>首先根据<span lang=EN-US>setup.s</span>程序取得的系统硬件参数（见本程序第<span
lang=EN-US>60--68</span>行）初始化几个本函数专用</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>的静态全局变量。</p>

<p class=a><a name=L843><u><span lang=EN-US style='color:blue'>843</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>video_num_columns</span></u> = <u><span style='color:blue'>ORIG_VIDEO_COLS</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>显示器显示字符列数。</p>

<p class=a><a name=L844><u><span lang=EN-US style='color:blue'>844</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>video_size_row</span></u> = <u><span style='color:blue'>video_num_columns</span></u>
* 2;&nbsp;&nbsp; // </span>每行字符需使用的字节数。</p>

<p class=a><a name=L845><u><span lang=EN-US style='color:blue'>845</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>video_num_lines</span></u> = <u><span style='color:blue'>ORIG_VIDEO_LINES</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>显示器显示字符行数。</p>

<p class=a><a name=L846><u><span lang=EN-US style='color:blue'>846</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>video_page</span></u> = <u><span style='color:blue'>ORIG_VIDEO_PAGE</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>当前显示页面。</p>

<p class=a><a name=L847><u><span lang=EN-US style='color:blue'>847</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>video_erase_char</span></u> = 0x0720;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>擦除字符（<span lang=EN-US>0x20</span>是字符，<span lang=EN-US>0x07</span>属性）。</p>

<p class=a><a name=L848><u><span lang=EN-US style='color:blue'>848</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>blankcount</span></u> = <u><span style='color:blue'>blankinterval</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>默认的黑屏间隔时间（嘀嗒数）。</p>

<p class=a><a name=L849><u><span lang=EN-US style='color:blue'>849</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后根据显示模式是单色还是彩色分别设置所使用的显示内存起始位置以及显示寄存器索引</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>端口号和显示寄存器数据端口号。如果获得的<span
lang=EN-US>BIOS</span>显示方式等于<span lang=EN-US>7</span>，则表示是单色显示卡。</p>

<p class=a><a name=L850><u><span lang=EN-US style='color:blue'>850</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>ORIG_VIDEO_MODE</span></u> == 7)&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><i>/*
Is this a monochrome display? */</i></b></span></p>

<p class=a><a name=L851><u><span lang=EN-US style='color:blue'>851</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>

<p class=a><a name=L852><u><span lang=EN-US style='color:blue'>852</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_mem_base</span></u> = 0xb0000;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置单显映像内存起始地址。</p>

<p class=a><a name=L853><u><span lang=EN-US style='color:blue'>853</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_port_reg</span></u> = 0x3b4;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置单显索引寄存器端口。</p>

<p class=a><a name=L854><u><span lang=EN-US style='color:blue'>854</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_port_val</span></u> = 0x3b5;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置单显数据寄存器端口。</p>

<p class=a><span lang=EN-US>&nbsp;</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>接着我们根据<span
lang=EN-US>BIOS</span>中断<span lang=EN-US>int 0x10</span>功能<span lang=EN-US>0x12</span>获得的显示模式信息，判断显示卡是单色显示卡</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>还是彩色显示卡。若使用上述中断功能所得到的<span
lang=EN-US>BX</span>寄存器返回值不等于<span lang=EN-US>0x10</span>，则说明是<span lang=EN-US>EGA</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>卡。因此初始显示类型为<span
lang=EN-US> EGA</span>单色。虽然<span lang=EN-US> EGA </span>卡上有较多显示内存，但在单色方式下最多只</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>能利用地址范围在<span
lang=EN-US>0xb0000--0xb8000</span>之间的显示内存。然后置显示器描述字符串为<span lang=EN-US>'</span><span
lang=EN-US>EGAm'</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>并会在系统初始化期间显示器描述字符串将显示在屏幕的右上角。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>注意，这里使用了<span
lang=EN-US>bx</span>在调用中断<span lang=EN-US>int 0x10</span>前后是否被改变的方法来判断卡的类型。若<span
lang=EN-US>BL</span>在</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>中断调用后值被改变，表示显示卡支持<span
lang=EN-US>Ah=12h</span>功能调用，是<span lang=EN-US>EGA</span>或后推出来的<span
lang=EN-US>VGA</span>等类型的</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>显示卡。若中断调用返回值未变，表示显示卡不支持这个功能，则说明是一般单色显示卡。</p>

<p class=a><a name=L855><u><span lang=EN-US style='color:blue'>855</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if ((<u><span style='color:blue'>ORIG_VIDEO_EGA_BX</span></u> &amp; 0xff) !=
0x10)</span></p>

<p class=a><a name=L856><u><span lang=EN-US style='color:blue'>856</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></p>

<p class=a><a name=L857><u><span lang=EN-US style='color:blue'>857</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_type</span></u> = <u><span style='color:blue'>VIDEO_TYPE_EGAM</span></u>;&nbsp;
// </span>设置显示类型（<span lang=EN-US>EGA</span>单色）。</p>

<p class=a><a name=L858><u><span lang=EN-US style='color:blue'>858</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_mem_term</span></u> = 0xb8000;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置显示内存末端地址。</p>

<p class=a><a name=L859><u><span lang=EN-US style='color:blue'>859</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
display_desc = <i>&quot;EGAm&quot;</i>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置显示描述字符串。</p>

<p class=a><a name=L860><u><span lang=EN-US style='color:blue'>860</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果<span lang=EN-US>BX</span>寄存器的值等于<span
lang=EN-US>0x10</span>，则说明是单色显示卡<span lang=EN-US>MDA</span>，仅有<span lang=EN-US>8KB</span>显示内存。</p>

<p class=a><a name=L861><u><span lang=EN-US style='color:blue'>861</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else</span></p>

<p class=a><a name=L862><u><span lang=EN-US style='color:blue'>862</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></p>

<p class=a><a name=L863><u><span lang=EN-US style='color:blue'>863</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_type</span></u> = <u><span style='color:blue'>VIDEO_TYPE_MDA</span></u>;&nbsp;&nbsp;
// </span>设置显示类型<span lang=EN-US>(MDA</span>单色<span lang=EN-US>)</span>。</p>

<p class=a><a name=L864><u><span lang=EN-US style='color:blue'>864</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_mem_term</span></u> = 0xb2000;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置显示内存末端地址。</p>

<p class=a><a name=L865><u><span lang=EN-US style='color:blue'>865</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
display_desc = <i>&quot;*MDA&quot;</i>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置显示描述字符串。</p>

<p class=a><a name=L866><u><span lang=EN-US style='color:blue'>866</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><a name=L867><u><span lang=EN-US style='color:blue'>867</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果显示方式不为<span
lang=EN-US>7</span>，说明是彩色显示卡。此时文本方式下所用显示内存起始地址为<span lang=EN-US>0xb8000</span>；</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>显示控制索引寄存器端口地址为 <span
lang=EN-US>0x3d4</span>；数据寄存器端口地址为 <span lang=EN-US>0x3d5</span>。</p>

<p class=a><a name=L868><u><span lang=EN-US style='color:blue'>868</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><i>/* If not, it is color. */</i></b></span></p>

<p class=a><a name=L869><u><span lang=EN-US style='color:blue'>869</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>

<p class=a><a name=L870><u><span lang=EN-US style='color:blue'>870</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>can_do_colour</span></u> = 1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置彩色显示标志。</p>

<p class=a><a name=L871><u><span lang=EN-US style='color:blue'>871</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_mem_base</span></u> = 0xb8000;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>显示内存起始地址。</p>

<p class=a><a name=L872><u><span lang=EN-US style='color:blue'>872</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_port_reg</span></u>&nbsp; = 0x3d4;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置彩色显示索引寄存器端口。</p>

<p class=a><a name=L873><u><span lang=EN-US style='color:blue'>873</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_port_val</span></u>&nbsp; = 0x3d5;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;// </span>设置彩色显示数据寄存器端口。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>再判断显示卡类别。如果<span
lang=EN-US>BX</span>不等于<span lang=EN-US>0x10</span>，则说明是<span lang=EN-US>EGA</span>显示卡，此时共有<span
lang=EN-US>32KB</span>显示内存可用</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>（<span lang=EN-US>0xb8000-0xc0000</span>）。否则说明是<span
lang=EN-US>CGA</span>显示卡，只能使用<span lang=EN-US>8KB</span>显示内存（<span lang=EN-US>0xb8000-0xba000</span>）。</p>

<p class=a><a name=L874><u><span lang=EN-US style='color:blue'>874</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if ((<u><span style='color:blue'>ORIG_VIDEO_EGA_BX</span></u> &amp; 0xff) !=
0x10)</span></p>

<p class=a><a name=L875><u><span lang=EN-US style='color:blue'>875</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></p>

<p class=a><a name=L876><u><span lang=EN-US style='color:blue'>876</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_type</span></u> = <u><span style='color:blue'>VIDEO_TYPE_EGAC</span></u>;&nbsp;
// </span>设置显示类型（<span lang=EN-US>EGA</span>彩色）。</p>

<p class=a><a name=L877><u><span lang=EN-US style='color:blue'>877</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_mem_term</span></u> = 0xc0000;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置显示内存末端地址。</p>

<p class=a><a name=L878><u><span lang=EN-US style='color:blue'>878</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
display_desc = <i>&quot;EGAc&quot;</i>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置显示描述字符串。</p>

<p class=a><a name=L879><u><span lang=EN-US style='color:blue'>879</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><a name=L880><u><span lang=EN-US style='color:blue'>880</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
else</span></p>

<p class=a><a name=L881><u><span lang=EN-US style='color:blue'>881</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span></p>

<p class=a><a name=L882><u><span lang=EN-US style='color:blue'>882</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_type</span></u> = <u><span style='color:blue'>VIDEO_TYPE_CGA</span></u>;&nbsp;&nbsp;
// </span>设置显示类型（<span lang=EN-US>CGA</span>）。</p>

<p class=a><a name=L883><u><span lang=EN-US style='color:blue'>883</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_mem_term</span></u> = 0xba000;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置显示内存末端地址。</p>

<p class=a><a name=L884><u><span lang=EN-US style='color:blue'>884</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
display_desc = <i>&quot;*CGA&quot;</i>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置显示描述字符串。</p>

<p class=a><a name=L885><u><span lang=EN-US style='color:blue'>885</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><a name=L886><u><span lang=EN-US style='color:blue'>886</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>现在我们来计算当前显示卡内存上可以开设的虚拟控制台数量。硬件允许开设的虚拟控制台数</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>量等于总显示内存量<span
lang=EN-US>video_memory</span>除以每个虚拟控制台占用的字节数。每个虚拟控制台占用的</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>显示内存数等于屏幕显示行数<span
lang=EN-US> video_num_lines </span>乘上每行字符占有的字节数<span lang=EN-US>video_size_row</span>。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>如果硬件允许开设的虚拟控制台数量大于系统限定的最大数量<span
lang=EN-US>MAX_CONSOLES</span>，就把虚拟控制台</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>数量设置为<span lang=EN-US>MAX_CONSOLES</span>。若这样计算出的虚拟控制台数量为<span
lang=EN-US>0</span>，则设置为<span lang=EN-US>1</span>（不可能吧！）。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>最后总显示内存数除以判断出的虚拟控制台数即得到每个虚拟控制台占用显示内存字节数。</p>

<p class=a><a name=L887><u><span lang=EN-US style='color:blue'>887</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; video_memory = <u><span
style='color:blue'>video_mem_term</span></u> - <u><span style='color:blue'>video_mem_base</span></u>;</span></p>

<p class=a><a name=L888><u><span lang=EN-US style='color:blue'>888</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>NR_CONSOLES</span></u> = video_memory / (<u><span
style='color:blue'>video_num_lines</span></u> * <u><span style='color:blue'>video_size_row</span></u>);</span></p>

<p class=a><a name=L889><u><span lang=EN-US style='color:blue'>889</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>NR_CONSOLES</span></u> &gt; <u><span style='color:blue'>MAX_CONSOLES</span></u>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// MAX_CONSOLES = 8</span>。</p>

<p class=a><a name=L890><u><span lang=EN-US style='color:blue'>890</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>NR_CONSOLES</span></u> = <u><span style='color:
blue'>MAX_CONSOLES</span></u>;</span></p>

<p class=a><a name=L891><u><span lang=EN-US style='color:blue'>891</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!<u><span
style='color:blue'>NR_CONSOLES</span></u>)</span></p>

<p class=a><a name=L892><u><span lang=EN-US style='color:blue'>892</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>NR_CONSOLES</span></u> = 1;</span></p>

<p class=a><a name=L893><u><span lang=EN-US style='color:blue'>893</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; video_memory /= <u><span
style='color:blue'>NR_CONSOLES</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>每个虚拟控制台占用显示内存字节数。</p>

<p class=a><a name=L894><u><span lang=EN-US style='color:blue'>894</span></u></a><span
lang=EN-US> </span></p>

<p class=a><a name=L895><u><span lang=EN-US style='color:blue'>895</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/* Let the
user known what kind of display driver we are using */</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* </span>初始化用于滚屏的变量（主要用于<span lang=EN-US>EGA/VGA</span>）<span lang=EN-US> */</span></p>

<p class=a><a name=L896><u><span lang=EN-US style='color:blue'>896</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>然后我们在屏幕的右上角显示描述字符串。采用的方法是直接将字符串写到显示内存的相应</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>位置处。首先将显示指针<span
lang=EN-US>display_ptr</span>指到屏幕第<span lang=EN-US>1</span>行右端差<span
lang=EN-US>4</span>个字符处（每个字符需<span lang=EN-US>2</span>个</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>字节，因此减<span
lang=EN-US>8</span>），然后循环复制字符串的字符，并且每复制<span lang=EN-US>1</span>个字符都空开<span
lang=EN-US>1</span>个属性字节。</p>

<p class=a><a name=L897><u><span lang=EN-US style='color:blue'>897</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; display_ptr =
((char *)<u><span style='color:blue'>video_mem_base</span></u>) + <u><span
style='color:blue'>video_size_row</span></u> - 8;</span></p>

<p class=a><a name=L898><u><span lang=EN-US style='color:blue'>898</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while
(*display_desc)</span></p>

<p class=a><a name=L899><u><span lang=EN-US style='color:blue'>899</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>

<p class=a><a name=L900><u><span lang=EN-US style='color:blue'>900</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*display_ptr++ = *display_desc++;</span></p>

<p class=a><a name=L901><u><span lang=EN-US style='color:blue'>901</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
display_ptr++;</span></p>

<p class=a><a name=L902><u><span lang=EN-US style='color:blue'>902</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><a name=L903><u><span lang=EN-US style='color:blue'>903</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p>

<p class=a><a name=L904><u><span lang=EN-US style='color:blue'>904</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/* Initialize
the variables used for scrolling (mostly EGA/VGA) */</i></b></span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* </span>初始化用于滚屏的变量<span lang=EN-US>(</span>主要用于<span lang=EN-US>EGA/VGA) */</span></p>

<p class=a><a name=L905><u><span lang=EN-US style='color:blue'>905</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>注意，此时当前虚拟控制台号<span
lang=EN-US>currcons</span>已被初始化位<span lang=EN-US>0</span>。因此下面实际上是初始化<span
lang=EN-US>0</span>号虚拟控</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>制台的结构<span lang=EN-US>vc_cons[0]</span>中的所有字段值。例如，这里符号<span
lang=EN-US>origin</span>在前面第<span lang=EN-US>115</span>行上已被定义为</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // vc_cons[0].vc_origin</span>。下面首先设置<span
lang=EN-US>0</span>号控制台的默认滚屏开始内存位置<span lang=EN-US> video_mem_start</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>和默认滚屏末行内存位置，实际上它们也就是<span
lang=EN-US>0</span>号控制台占用的部分显示内存区域。然后初始</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>设置<span lang=EN-US>0</span>号虚拟控制台的其他属性和标志值。</p>

<p class=a><a name=L906><u><span lang=EN-US style='color:blue'>906</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base = <u><span
style='color:blue'>origin</span></u> = <u><span style='color:blue'>video_mem_start</span></u>
= <u><span style='color:blue'>video_mem_base</span></u>;&nbsp; // </span>默认滚屏开始内存位置。</p>

<p class=a><a name=L907><u><span lang=EN-US style='color:blue'>907</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>term</span></u> = <u><span style='color:blue'>video_mem_end</span></u>
= base + video_memory;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 0</span>号屏幕内存末端位置。</p>

<p class=a><a name=L908><u><span lang=EN-US style='color:blue'>908</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>scr_end</span></u> = <u><span style='color:blue'>video_mem_start</span></u>
+ <u><span style='color:blue'>video_num_lines</span></u> * <u><span
style='color:blue'>video_size_row</span></u>; // </span>滚屏末端位置。</p>

<p class=a><a name=L909><u><span lang=EN-US style='color:blue'>909</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>top</span></u>&nbsp;&nbsp;&nbsp;&nbsp; = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>初始设置滚动时顶行行号和底行行号。 </p>

<p class=a><a name=L910><u><span lang=EN-US style='color:blue'>910</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>bottom</span></u>&nbsp; = <u><span style='color:blue'>video_num_lines</span></u>;</span></p>

<p class=a><a name=L911><u><span lang=EN-US style='color:blue'>911</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>attr</span></u> = 0x07;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>初始设置显示字符属性（黑底白字）。</p>

<p class=a><a name=L912><u><span lang=EN-US style='color:blue'>912</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>def_attr</span></u> = 0x07;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置默认显示字符属性。</p>

<p class=a><a name=L913><u><span lang=EN-US style='color:blue'>913</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>restate</span></u> = <u><span style='color:blue'>state</span></u>
= ESnormal;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>初始化转义序列操作的当前和下一状态。</p>

<p class=a><a name=L914><u><span lang=EN-US style='color:blue'>914</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>checkin</span></u> = 0;</span></p>

<p class=a><a name=L915><u><span lang=EN-US style='color:blue'>915</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>ques</span></u> = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>收到问号字符标志。</p>

<p class=a><a name=L916><u><span lang=EN-US style='color:blue'>916</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>iscolor</span></u> = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>彩色显示标志。</p>

<p class=a><a name=L917><u><span lang=EN-US style='color:blue'>917</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>translate</span></u> = <u><span style='color:blue'>NORM_TRANS</span></u>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>使用的字符集（普通<span lang=EN-US>ASCII</span>码表）。</p>

<p class=a><a name=L918><u><span lang=EN-US style='color:blue'>918</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>vc_cons</span></u>[0].vc_bold_attr = -1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>粗体字符属性标志（<span lang=EN-US>-1</span>表示不用）。</p>

<p class=a><a name=L919><u><span lang=EN-US style='color:blue'>919</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>在设置了<span lang=EN-US>0</span>号控制台当前光标所在位置和光标对应的内存位置<span
lang=EN-US>pos</span>后，我们循环设置其余的几</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>个虚拟控制台结构的参数值。除了各自占用的显示内存开始和结束位置不同，它们的初始值基</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>本上都与<span lang=EN-US>0</span>号控制台相同。</p>

<p class=a><a name=L920><u><span lang=EN-US style='color:blue'>920</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>gotoxy</span></u>(currcons,<u><span style='color:blue'>ORIG_X</span></u>,<u><span
style='color:blue'>ORIG_Y</span></u>);</span></p>

<p class=a><a name=L921><u><span lang=EN-US style='color:blue'>921</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (currcons = 1;
currcons&lt;<u><span style='color:blue'>NR_CONSOLES</span></u>; currcons++) {</span></p>

<p class=a><a name=L922><u><span lang=EN-US style='color:blue'>922</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>vc_cons</span></u>[currcons] = <u><span
style='color:blue'>vc_cons</span></u>[0];&nbsp;&nbsp;&nbsp;&nbsp; // </span>复制<span
lang=EN-US>0</span>号结构的参数。</p>

<p class=a><a name=L923><u><span lang=EN-US style='color:blue'>923</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>origin</span></u> = <u><span style='color:blue'>video_mem_start</span></u>
= (base += video_memory);</span></p>

<p class=a><a name=L924><u><span lang=EN-US style='color:blue'>924</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>scr_end</span></u> = <u><span style='color:blue'>origin</span></u>
+ <u><span style='color:blue'>video_num_lines</span></u> * <u><span
style='color:blue'>video_size_row</span></u>;</span></p>

<p class=a><a name=L925><u><span lang=EN-US style='color:blue'>925</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>video_mem_end</span></u> = (<u><span
style='color:blue'>term</span></u> += video_memory);</span></p>

<p class=a><a name=L926><u><span lang=EN-US style='color:blue'>926</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>gotoxy</span></u>(currcons,0,0);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>光标都初始化在屏幕左上角位置。</p>

<p class=a><a name=L927><u><span lang=EN-US style='color:blue'>927</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>最后设置当前前台控制台的屏幕原点（左上角）位置和显示控制器中光标显示位置，并设置键</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>盘中断<span lang=EN-US>0x21</span>陷阱门描述符（<span
lang=EN-US>&amp;keyboard_interrupt</span>是键盘中断处理过程地址）。然后取消中断</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>控制芯片<span
 lang=EN-US>8259A</span><span lang=EN-US> </span>中对键盘中断的屏蔽，允许响应键盘发出的 <span
lang=EN-US>IRQ1 </span>请求信号。最后复位键盘控</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>制器以允许键盘开始正常工作。</p>

<p class=a><a name=L928><u><span lang=EN-US style='color:blue'>928</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>update_screen</span></u>();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>更新前台原点和设置光标位置。</p>

<p class=a><a name=L929><u><span lang=EN-US style='color:blue'>929</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>set_trap_gate</span></u>(0x21,&amp;<u><span
style='color:blue'>keyboard_interrupt</span></u>); // </span>参见<span
lang=EN-US>system.h</span>，第<span lang=EN-US>36</span>行开始。</p>

<p class=a><a name=L930><u><span lang=EN-US style='color:blue'>930</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(<u><span style='color:blue'>inb_p</span></u>(0x21)&amp;0xfd,0x21);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>取消对键盘中断的屏蔽，允许<span lang=EN-US>IRQ1</span>。</p>

<p class=a><a name=L931></a><u><span
 lang=EN-US style='color:blue'>931</span></u><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 a</span><span lang=EN-US>=<u><span style='color:blue'>inb_p</span></u>(0x61);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>读取键盘端口<span lang=EN-US>0x61</span>（<span
 lang=EN-US>8255A</span>端口<span lang=EN-US>PB</span>）。</p>

<p class=a><a name=L932><u><span lang=EN-US style='color:blue'>932</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(a|0x80,0x61);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置禁止键盘工作（位<span lang=EN-US>7</span>置位），</p>

<p class=a><a name=L933><u><span lang=EN-US style='color:blue'>933</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(a,0x61);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>再允许键盘工作，用以复位键盘。</p>

<p class=a><a name=L934><u><span lang=EN-US style='color:blue'>934</span></u></a><span
lang=EN-US> }</span></p>

<p class=a><a name=L935><u><span lang=EN-US style='color:blue'>935</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>更新当前前台控制台。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>把前台控制台转换为<span
lang=EN-US>fg_console</span>指定的虚拟控制台。<span lang=EN-US>fg_console</span>是设置的前台虚拟控制台号。</p>

<p class=a><a name=L936><u><span lang=EN-US style='color:blue'>936</span></u></a><span
lang=EN-US> void <u><span style='color:blue'>update_screen</span></u>(void)</span></p>

<p class=a><a name=L937><u><span lang=EN-US style='color:blue'>937</span></u></a><span
lang=EN-US> {</span></p>

<p class=a><a name=L938><u><span lang=EN-US style='color:blue'>938</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>set_origin</span></u>(<u><span style='color:blue'>fg_console</span></u>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置滚屏起始显示内存地址。</p>

<p class=a><a name=L939><u><span lang=EN-US style='color:blue'>939</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>set_cursor</span></u>(<u><span style='color:blue'>fg_console</span></u>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>设置显示控制器中光标显示内存位置。</p>

<p class=a><a name=L940><u><span lang=EN-US style='color:blue'>940</span></u></a><span
lang=EN-US> }</span></p>

<p class=a><a name=L941><u><span lang=EN-US style='color:blue'>941</span></u></a><span
lang=EN-US> </span></p>

<p class=a><a name=L942><u><span lang=EN-US style='color:blue'>942</span></u></a><span
lang=EN-US> <b><i>/* from bsd-net-2: */</i></b></span></p>

<p class=a><a name=L943><u><span lang=EN-US style='color:blue'>943</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>停止蜂鸣。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>复位<span
 lang=EN-US>8255A</span><span lang=EN-US> PB</span>端口的位<span lang=EN-US>1</span>和位<span
lang=EN-US>0</span>。参见<span lang=EN-US>kernel/sched.c</span>程序后的定时器编程说明。</p>

<p class=a><a name=L944><u><span lang=EN-US style='color:blue'>944</span></u></a><span
lang=EN-US> void <u><span style='color:blue'>sysbeepstop</span></u>(void)</span></p>

<p class=a><a name=L945><u><span lang=EN-US style='color:blue'>945</span></u></a><span
lang=EN-US> {</span></p>

<p class=a><a name=L946><u><span lang=EN-US style='color:blue'>946</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/* disable
counter 2 */</i></b>&nbsp; /* </span>禁止定时器<span lang=EN-US>2 */</span></p>

<p class=a><a name=L947><u><span lang=EN-US style='color:blue'>947</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb</span></u>(<u><span style='color:blue'>inb_p</span></u>(0x61)&amp;0xFC,
0x61);</span></p>

<p class=a><a name=L948><u><span lang=EN-US style='color:blue'>948</span></u></a><span
lang=EN-US> }</span></p>

<p class=a><a name=L949><u><span lang=EN-US style='color:blue'>949</span></u></a><span
lang=EN-US> </span></p>

<p class=a><a name=L950><u><span lang=EN-US style='color:blue'>950</span></u></a><span
lang=EN-US> int <u><span style='color:blue'>beepcount</span></u> = 0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>蜂鸣时间嘀嗒计数。</p>

<p class=a><a name=L951><u><span lang=EN-US style='color:blue'>951</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>开通蜂鸣。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // 8255A</span>芯片<span
lang=EN-US>PB</span>端口的位<span lang=EN-US>1</span>用作扬声器的开门信号；位<span lang=EN-US>0</span>用作<span
lang=EN-US>8253</span>定时器<span lang=EN-US>2</span>的门信号，该定时</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>器的输出脉冲送往扬声器，作为扬声器发声的频率。因此要使扬声器蜂鸣，需要两步：首先开</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>启<span lang=EN-US> PB</span>端口（<span
lang=EN-US>0x61</span>）位<span lang=EN-US>1</span>和 位<span lang=EN-US>0</span>（置位），然后设置定时器<span
lang=EN-US>2</span>通道发送一定的定时频率即可。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参见<span lang=EN-US>boot/setup.s</span>程序后<span
 lang=EN-US>8259A</span>芯片编程方法和<span lang=EN-US>kernel/sched.c</span>程序后的定时器编程说明。</p>

<p class=a><a name=L952><u><span lang=EN-US style='color:blue'>952</span></u></a><span
lang=EN-US> static void <u><span style='color:blue'>sysbeep</span></u>(void)</span></p>

<p class=a><a name=L953><u><span lang=EN-US style='color:blue'>953</span></u></a><span
lang=EN-US> {</span></p>

<p class=a><a name=L954><u><span lang=EN-US style='color:blue'>954</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/* enable
counter 2 */</i></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* </span>开启定时器<span
lang=EN-US>2 */</span></p>

<p class=a><a name=L955><u><span lang=EN-US style='color:blue'>955</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(<u><span style='color:blue'>inb_p</span></u>(0x61)|3,
0x61);</span></p>

<p class=a><a name=L956><u><span lang=EN-US style='color:blue'>956</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/* set
command for counter 2, 2 byte write */</i></b>&nbsp;&nbsp;&nbsp; /* </span>送设置定时器<span
lang=EN-US>2</span>命令<span lang=EN-US> */</span></p>

<p class=a><a name=L957><u><span lang=EN-US style='color:blue'>957</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(0xB6, 0x43);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>定时器芯片控制字寄存器端口。</p>

<p class=a><a name=L958><u><span lang=EN-US style='color:blue'>958</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/* send 0x637
for 750 HZ */</i></b>&nbsp;&nbsp;&nbsp;&nbsp; /* </span>设置频率为<span lang=EN-US>750HZ</span>，因此送定时值<span
lang=EN-US>0x637 */</span></p>

<p class=a><a name=L959><u><span lang=EN-US style='color:blue'>959</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb_p</span></u>(0x37, 0x42);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// </span>通道<span lang=EN-US>2</span>数据端口分别送计数高低字节。</p>

<p class=a><a name=L960><u><span lang=EN-US style='color:blue'>960</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>outb</span></u>(0x06, 0x42);</span></p>

<p class=a><a name=L961><u><span lang=EN-US style='color:blue'>961</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><i>/* 1/8 second
*/</i></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* </span>蜂鸣时间为<span lang=EN-US>1/8</span>秒<span lang=EN-US> */</span></p>

<p class=a><a name=L962><u><span lang=EN-US style='color:blue'>962</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>beepcount</span></u> = <u><span style='color:blue'>HZ</span></u>/8;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></p>

<p class=a><a name=L963><u><span lang=EN-US style='color:blue'>963</span></u></a><span
lang=EN-US> }</span></p>

<p class=a><a name=L964><u><span lang=EN-US style='color:blue'>964</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>拷贝屏幕。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>把屏幕内容复制到参数指定的用户缓冲区<span
lang=EN-US>arg</span>中。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数<span lang=EN-US>arg</span>有两个用途，一是用于传递控制台号，二是作为用户缓冲区指针。</p>

<p class=a><a name=L965><u><span lang=EN-US style='color:blue'>965</span></u></a><span
lang=EN-US> int <u><span style='color:blue'>do_screendump</span></u>(int arg)</span></p>

<p class=a><a name=L966><u><span lang=EN-US style='color:blue'>966</span></u></a><span
lang=EN-US> {</span></p>

<p class=a><a name=L967><u><span lang=EN-US style='color:blue'>967</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *sptr, *<u><span
style='color:blue'>buf</span></u> = (char *)arg;</span></p>

<p class=a><a name=L968><u><span lang=EN-US style='color:blue'>968</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int currcons, l;</span></p>

<p class=a><a name=L969><u><span lang=EN-US style='color:blue'>969</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>函数首先验证用户提供的缓冲区容量，若不够则进行适当扩展。然后从其开始处取出控制台</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>号<span lang=EN-US>currcons</span>。在判断控制台号有效之后，就把该控制台屏幕的所有内存内容复制到用户缓冲</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>区中。</p>

<p class=a><a name=L970><u><span lang=EN-US style='color:blue'>970</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>verify_area</span></u>(<u><span style='color:blue'>buf</span></u>,<u><span
style='color:blue'>video_num_columns</span></u>*<u><span style='color:blue'>video_num_lines</span></u>);</span></p>

<p class=a><a name=L971><u><span lang=EN-US style='color:blue'>971</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currcons = <u><span
style='color:blue'>get_fs_byte</span></u>(<u><span style='color:blue'>buf</span></u>);</span></p>

<p class=a><a name=L972><u><span lang=EN-US style='color:blue'>972</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((currcons&lt;1)
|| (currcons&gt;<u><span style='color:blue'>NR_CONSOLES</span></u>))</span></p>

<p class=a><a name=L973><u><span lang=EN-US style='color:blue'>973</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return -<u><span style='color:blue'>EIO</span></u>;</span></p>

<p class=a><a name=L974><u><span lang=EN-US style='color:blue'>974</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currcons--;</span></p>

<p class=a><a name=L975><u><span lang=EN-US style='color:blue'>975</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sptr = (char *) <u><span
style='color:blue'>origin</span></u>;</span></p>

<p class=a><a name=L976><u><span lang=EN-US style='color:blue'>976</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (l=<u><span
style='color:blue'>video_num_lines</span></u>*<u><span style='color:blue'>video_num_columns</span></u>;
l&gt;0 ; l--)</span></p>

<p class=a><a name=L977><u><span lang=EN-US style='color:blue'>977</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>put_fs_byte</span></u>(*sptr++,<u><span
style='color:blue'>buf</span></u>++);&nbsp;&nbsp;&nbsp;&nbsp; </span></p>

<p class=a><a name=L978><u><span lang=EN-US style='color:blue'>978</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return(0);</span></p>

<p class=a><a name=L979><u><span lang=EN-US style='color:blue'>979</span></u></a><span
lang=EN-US> }</span></p>

<p class=a><a name=L980><u><span lang=EN-US style='color:blue'>980</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>黑屏处理。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>当用户在<span lang=EN-US>blankInterval</span>时间间隔内没有按任何按键时就让屏幕黑屏，以保护屏幕。</p>

<p class=a><a name=L981><u><span lang=EN-US style='color:blue'>981</span></u></a><span
lang=EN-US> void <u><span style='color:blue'>blank_screen</span></u>()</span></p>

<p class=a><a name=L982><u><span lang=EN-US style='color:blue'>982</span></u></a><span
lang=EN-US> {</span></p>

<p class=a><a name=L983><u><span lang=EN-US style='color:blue'>983</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>video_type</span></u> != <u><span style='color:blue'>VIDEO_TYPE_EGAC</span></u>
&amp;&amp; <u><span style='color:blue'>video_type</span></u> != <u><span
style='color:blue'>VIDEO_TYPE_EGAM</span></u>)</span></p>

<p class=a><a name=L984><u><span lang=EN-US style='color:blue'>984</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><a name=L985><u><span lang=EN-US style='color:blue'>985</span></u></a><span
lang=EN-US> <b><i>/* blank here. I can't find out how to do it, though */</i></b></span></p>

<p class=a><a name=L986><u><span lang=EN-US style='color:blue'>986</span></u></a><span
lang=EN-US> }</span></p>

<p class=a><a name=L987><u><span lang=EN-US style='color:blue'>987</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>恢复黑屏的屏幕。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>当用户按下任何按键时，就恢复处于黑屏状态的屏幕显示内容。</p>

<p class=a><a name=L988><u><span lang=EN-US style='color:blue'>988</span></u></a><span
lang=EN-US> void <u><span style='color:blue'>unblank_screen</span></u>()</span></p>

<p class=a><a name=L989><u><span lang=EN-US style='color:blue'>989</span></u></a><span
lang=EN-US> {</span></p>

<p class=a><a name=L990><u><span lang=EN-US style='color:blue'>990</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<u><span
style='color:blue'>video_type</span></u> != <u><span style='color:blue'>VIDEO_TYPE_EGAC</span></u>
&amp;&amp; <u><span style='color:blue'>video_type</span></u> != <u><span
style='color:blue'>VIDEO_TYPE_EGAM</span></u>)</span></p>

<p class=a><a name=L991><u><span lang=EN-US style='color:blue'>991</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return;</span></p>

<p class=a><a name=L992><u><span lang=EN-US style='color:blue'>992</span></u></a><span
lang=EN-US> <b><i>/* unblank here */</i></b></span></p>

<p class=a><a name=L993><u><span lang=EN-US style='color:blue'>993</span></u></a><span
lang=EN-US> }</span></p>

<p class=a><a name=L994><u><span lang=EN-US style='color:blue'>994</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; //// </span>控制台显示函数。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>该函数仅用于内核显示函数<span
lang=EN-US>printk()</span>（<span lang=EN-US>kernel/printk.c</span>），用于在当前前台控制台上显示</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>内核信息。处理方法是循环取出缓冲区中的字符，并根据字符的特性控制光标移动或直接显</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>示在屏幕上。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>参数 <span lang=EN-US>b</span>是<span
lang=EN-US>null</span>结尾的字符串缓冲区指针。</p>

<p class=a><a name=L995><u><span lang=EN-US style='color:blue'>995</span></u></a><span
lang=EN-US> void <u><span style='color:blue'>console_print</span></u>(const
char * b)</span></p>

<p class=a><a name=L996><u><span lang=EN-US style='color:blue'>996</span></u></a><span
lang=EN-US> {</span></p>

<p class=a><a name=L997><u><span lang=EN-US style='color:blue'>997</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int currcons = <u><span
style='color:blue'>fg_console</span></u>;</span></p>

<p class=a><a name=L998><u><span lang=EN-US style='color:blue'>998</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char c;</span></p>

<p class=a><a name=L999><u><span lang=EN-US style='color:blue'>999</span></u></a><span
lang=EN-US> </span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>循环读取缓冲区<span
lang=EN-US>b</span>中的字符。如果当前字符<span lang=EN-US>c</span>是换行符，则对光标执行回车换行操作；然后</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>去处理下一个字符。如果是回车符，就直接执行回车动作。然后去处理下一个字符。</p>

<p class=a><a name=L1000><u><span lang=EN-US style='color:blue'>1000</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (c = *(b++))
{</span></p>

<p class=a><a name=L1001><u><span lang=EN-US style='color:blue'>1001</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (c == 10) {</span></p>

<p class=a><a name=L1002><u><span lang=EN-US style='color:blue'>1002</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>cr</span></u>(currcons);</span></p>

<p class=a><a name=L1003><u><span lang=EN-US style='color:blue'>1003</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;<u><span style='color:blue'>lf</span></u>(currcons);</span></p>

<p class=a><a name=L1004><u><span lang=EN-US style='color:blue'>1004</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
continue;</span></p>

<p class=a><a name=L1005><u><span lang=EN-US style='color:blue'>1005</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><a name=L1006><u><span lang=EN-US style='color:blue'>1006</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (c == 13) {</span></p>

<p class=a><a name=L1007><u><span lang=EN-US style='color:blue'>1007</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>cr</span></u>(currcons);</span></p>

<p class=a><a name=L1008><u><span lang=EN-US style='color:blue'>1008</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
continue;</span></p>

<p class=a><a name=L1009><u><span lang=EN-US style='color:blue'>1009</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>在读取了一个不是回车或换行字符后，如果发现当前光标列位置<span
lang=EN-US>x</span>已经到达屏幕右末端，则让</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>光标折返到下一行开始处。然后把字符放到光标所处显示内存位置处，即在屏幕上显示出来。</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>再把光标右移一格位置，为显示下一个字符作准备。</p>

<p class=a><a name=L1010><u><span lang=EN-US style='color:blue'>1010</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (<u><span style='color:blue'>x</span></u>&gt;=<u><span style='color:blue'>video_num_columns</span></u>)
{</span></p>

<p class=a><a name=L1011><u><span lang=EN-US style='color:blue'>1011</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>x</span></u> -= <u><span style='color:blue'>video_num_columns</span></u>;</span></p>

<p class=a><a name=L1012><u><span lang=EN-US style='color:blue'>1012</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> -= <u><span style='color:blue'>video_size_row</span></u>;</span></p>

<p class=a><a name=L1013><u><span lang=EN-US style='color:blue'>1013</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u><span
style='color:blue'>lf</span></u>(currcons);</span></p>

<p class=a><a name=L1014><u><span lang=EN-US style='color:blue'>1014</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>寄存器<span lang=EN-US>al</span>中是需要显示的字符，这里把属性字节放到<span
lang=EN-US>ah</span>中，然后把<span lang=EN-US>ax</span>内容存储到光标内存</p>

<p class=a><span lang=EN-US>&nbsp;&nbsp;&nbsp; // </span>位置<span lang=EN-US>pos</span>处，即在光标处显示字符。</p>

<p class=a><a name=L1015><u><span lang=EN-US style='color:blue'>1015</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
__asm__(<i>&quot;movb %2,%%ah\n\t&quot;</i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//
</span>属性字节放到<span lang=EN-US>ah</span>中。</p>

<p class=a><a name=L1016><u><span lang=EN-US style='color:blue'>1016</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;movw %%ax,%1\n\t&quot;</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// ax</span>内容放到<span lang=EN-US>pos</span>处。</p>

<p class=a><a name=L1017><u><span lang=EN-US style='color:blue'>1017</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
::<i>&quot;a&quot;</i> (c),</span></p>

<p class=a><a name=L1018><u><span lang=EN-US style='color:blue'>1018</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;m&quot;</i> (*(short *)<u><span style='color:blue'>pos</span></u>),</span></p>

<p class=a><a name=L1019><u><span lang=EN-US style='color:blue'>1019</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>&quot;m&quot;</i> (<u><span style='color:blue'>attr</span></u>)</span></p>

<p class=a><a name=L1020><u><span lang=EN-US style='color:blue'>1020</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:<i>&quot;ax&quot;</i>);</span></p>

<p class=a><a name=L1021><u><span lang=EN-US style='color:blue'>1021</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>pos</span></u> += 2;</span></p>

<p class=a><a name=L1022><u><span lang=EN-US style='color:blue'>1022</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u><span style='color:blue'>x</span></u>++;</span></p>

<p class=a><a name=L1023><u><span lang=EN-US style='color:blue'>1023</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></p>

<p class=a><a name=L1024><u><span lang=EN-US style='color:blue'>1024</span></u></a><span
lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u><span
style='color:blue'>set_cursor</span></u>(currcons); // </span>最后设置的光标内存位置，设置显示控制器中光标位置。</p>

<p class=a><a name=L1025><u><span lang=EN-US style='color:blue'>1025</span></u></a><span
lang=EN-US> }</span></p>

<p class=a><a name=L1026><u><span lang=EN-US style='color:blue'>1026</span></u></a><span
lang=EN-US> </span></p>

<div class=a align=center style='text-align:center'><span lang=EN-US>

<hr size=4 width="100%" align=center>

</span></div>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

</div>

</body>

</html>
